[platformio]
;default_envs = box7

;CHANGE THE VERSION BELOW !!!!!!
[program_customisation]
version = "1.8.1"
client  = "001-fv"

[common]
build_flags = 
    '-D FW_VERSION=${program_customisation.version}'
    '-D CLIENT=${program_customisation.client}'
    ; -DCORE_DEBUG_LEVEL=0
    -DCORE_DEBUG_LEVEL=5


; to see the commands in Serial
; https://docs.platformio.org/en/latest/projectconf/sections/env/options/monitor/index.html#monitor-echo
; monitor_flags =
;     --echo
monitor_filters = time, colorize, esp32_exception_decoder
platform = espressif32
framework = arduino


lib_deps =
    sparkfun/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.4
    adafruit/Adafruit SHT31 Library @ ^2.2.0
    adafruit/Adafruit TSL2561 @ ^1.1.0
    adafruit/Adafruit BusIO @ ^1.13.2
    SPI
    WiFi
    ; homespan/HomeSpan @ ^1.7.0
    ottowinter/ESPAsyncTCP-esphome @ ^1.2.3
    esphome/ESPAsyncWebServer-esphome@^2.1.0
    ; fixed to 2.0.0 as newer does not compile
    esphome/AsyncTCP-esphome@2.0.0



; =========================================================================================================
; CUSTOM board: ZH bare module OK, here are partition and pins
; /Users/papio/.platformio/packages/framework-arduinoespressif32/variants/zh_esp32s3_bare_module 
; here is where the boards are described:

; using UART, with DARDUINO_USB_CDC_ON_BOOT=0
; /Users/papio/.platformio/platforms/espressif32/boards/zh_esp32s3_bare_module.json

; using UART, with DARDUINO_USB_CDC_ON_BOOT=0 - same as above - linked
; /Users/papio/.platformio/platforms/espressif32/boards/zh_esp32s3_bare_module-uart.json

; using USB OTG, with DARDUINO_USB_CDC_ON_BOOT=1
; no need to have reset and gpio 0 exposed for programming - it does it automatically (like RTS/DTR)
; /Users/papio/.platformio/platforms/espressif32/boards/zh_esp32s3_bare_module-usb-otg.json


; [zh_esp32s3_bare_module]
; board = zh_esp32s3_bare_module

; [zh_esp32s3_bare_module-uart]
; board = zh_esp32s3_bare_module-uart

; [zh_esp32s3_bare_module-usbotg]
; board = zh_esp32s3_bare_module-usb-otg
; =========================================================================================================


[esp32s2]
board=esp32-s2-saola-1


[esp32c3]
board=esp32-c3-devkitm-1


; [wemoss3minilolin]
; board = lolin_s3_mini

[env]
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${scripts_defaults.extra_scripts}
; upload_port = /dev/SLAB_USB*

[scripts_defaults]
extra_scripts =
    post:extra_scripts/output_bins.py
    post:extra_scripts/erase_before_upload.py


[base]
monitor_filters         = ${common.monitor_filters}
platform                = ${common.platform}
framework               = ${common.framework}
lib_deps                = ${common.lib_deps}
build_flags             = ${common.build_flags}
board_build.partitions  = min_spiffs.csv


; ********************* PRODUCTION boards definition start here *********************

[env:box1]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=1' 

[env:box2]
extends                 = base
board                   = ${esp32s2.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=2' 

[env:box3]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=3' 

[env:box4]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=4' 

[env:box5]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=5' 

[env:box6]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=6' 

[env:box7]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=7' 

; _____________________________________________________________________________________________________



; [env:box44]
; upload_port             = /dev/cu.usbmodem*
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=44' 
;     -DARDUINO_USB_MODE=1
;     -DARDUINO_USB_CDC_ON_BOOT=1
;     ; -DCORE_DEBUG_LEVEL=5


[env:box42]
; upload_port             = /dev/cu.usbmodem*
extends                 = base
board                   = ${esp32s2.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=42' 
 