[platformio]
; default_envs = bridge3

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

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


[common]
build_flags = 
    '-D BRIDGE_FW=${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 =
    FS
    WiFi
    Wire
; ALL BELOW ARE LOCAL - FIXED VERSIONS - uncomment if you want to upgrade lib
; bblanchon/ArduinoJson @ ^6.19.4
; ayushsharma82/AsyncElegantOTA @ ^2.2.7
; fixed to 2.0.0 as newer does not compile
; esphome/AsyncTCP-esphome@2.0.0
; tobiasschuerg/ESP8266 Influxdb @ ^3.13.0
; ottowinter/ESPAsyncTCP-esphome @ ^1.2.3
; esphome/ESPAsyncWebServer-esphome@^2.1.0
; amcewen/HttpClient @ ^2.2.0
; knolleary/PubSubClient @ ^2.8
; sparkfun/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.4

; ==================== HomeSpan MUST BE LOCAL as some functions are changed, i.e. RSSI ==================== 
; homespan/HomeSpan @ ^1.7.0 - DON'T UNCOMMENT IT!!!
; ==================== HomeSpan MUST BE LOCAL as some functions are changed, i.e. RSSI ==================== 


[esp32]
board=esp32dev

; 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

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

[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:bridge1]
extends                 = base
board                   = ${esp32.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=1' 

; ********************* TESTING boards definition start here *********************

; LAB for FV bridge1
[env:bridge11]
extends                 = base
board                   = ${esp32.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=11' 

; USE THE SAME ENV:NAME or the file name on server will be different!
; [env:bridge3]
; extends                 = base
; board                   = ${zh_esp32s3_bare_module.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=3'


; [env:bridge3]
; extends                 = base
; board                   = ${zh_esp32s3_bare_module-uart.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=3'


[env:bridge3]
extends                 = base
board                   = ${zh_esp32s3_bare_module-usbotg.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=3'
    -DARDUINO_USB_MODE=1