[platformio]
default_envs = esp32047

;CHANGE THE VERSION BELOW !!!!!!
[program_customisation]
version = "3.9.7"
client  = "yourclient"


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

lib_deps =
    ADC
    FS
    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
    ottowinter/ESPAsyncTCP-esphome @ ^1.2.3
    esphome/AsyncTCP-esphome@^1.2.2
    esphome/ESPAsyncWebServer-esphome@^2.1.0
    bblanchon/ArduinoJson @ ^6.19.4
    SPIFFS
    ayushsharma82/AsyncElegantOTA @ ^2.2.7
    sandeepmistry/LoRa @ ^0.8.0


monitor_filters = time, colorize, esp32_exception_decoder
platform = espressif32
framework = arduino   

; =========================================================================================================
; CUSTOM board: ZH bare module OK, here are partition and pins
; ~/.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
; ~/.platformio/platforms/espressif32/boards/zh_esp32s3_bare_module.json

; using UART, with DARDUINO_USB_CDC_ON_BOOT=0 - same as above - linked
; ~/.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)
; ~/.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
; =========================================================================================================


[esp32]
board=esp32dev

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

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

[wemoss3minilolin]
board = lolin_s3_mini

[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}

[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}

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


; [env:esp32021]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=21' 


; [env:esp32022]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=22' 


; [env:esp32023]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=23' 


; [env:esp32026]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=26' 

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

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

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

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

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

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


; [env:esp32037]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=37' 

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

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

[env:esp32041]
extends                 = base
board                   = ${esp32.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=41'
lib_deps                = ${common.lib_deps}
    adafruit/Adafruit MAX31855 library @ ^1.4.0

[env:esp32042]
extends                 = base
board                   = ${esp32s2.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=42'
lib_deps                = ${common.lib_deps}

[env:esp32043]
extends                 = base
board                   = ${esp32s2.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=43'
lib_deps                = ${common.lib_deps}
    pstolarz/OneWireNg @ ^0.13.1

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

[env:esp32045]
upload_port             = /dev/cu.usbmodem*
extends                 = base
board                   = ${wemoss3minilolin.board}
build_flags             = ${base.build_flags} 
    -D DEVICE_ID=45
    -DBOARD_HAS_PSRAM
    -DARDUINO_USB_MODE=1
    -DARDUINO_USB_CDC_ON_BOOT=1


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


; WeAct Studio ESP32 C3 board - OK
[env:esp32047]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} 
    -D DEVICE_ID=47
    -DARDUINO_USB_MODE=1
    -DARDUINO_USB_CDC_ON_BOOT=1

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


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

[env:esp32051]
extends                 = base
board                   = ${esp32s2.board}
build_flags             = ${base.build_flags} '-D DEVICE_ID=51'
lib_deps                = ${common.lib_deps}
    adafruit/Adafruit INA260 Library @ ^1.5.0


; [env:esp32055]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=55' 

; ; TRV7 Tailor
; [env:esp32056]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=56' 

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

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

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

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

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


; ********************* TEST boards definition start here *********************

; ; S2 
; [env:esp32082]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=82'

; WeAct Studio ESP32 C3 board - OK
[env:esp32083]
extends                 = base
board                   = ${esp32c3.board}
build_flags             = ${base.build_flags} 
    -D DEVICE_ID=83
    -DARDUINO_USB_MODE=1
    -DARDUINO_USB_CDC_ON_BOOT=1

; [env:esp32091]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=91'



; [env:esp32092]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=92'
; ; lib_deps                = ${common.lib_deps}
;     ; tinyu-zhao/INA3221 @ ^0.0.1

; [env:esp32093]
; extends                 = base
; board                   = ${esp32.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=93'


; [env:esp32094]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=94'
; lib_deps                = ${common.lib_deps}
;     adafruit/Adafruit INA260 Library @ ^1.5.0



; [env:esp32094]
; extends                 = base
; board                   = ${esp32c3.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=94' 

; [env:esp32095]
; upload_port             = /dev/cu.usbmodem*
; extends                 = base
; board                   = ${wemoss3minilolin.board}
; build_flags             = ${base.build_flags} 
;     -D DEVICE_ID=95
;     -DBOARD_HAS_PSRAM
;     -DARDUINO_USB_MODE=1
;     -DARDUINO_USB_CDC_ON_BOOT=1


[env:esp32095]
extends                 = base
platform                = espressif32
board                   = lolin_s3_mini
framework               = arduino
monitor_speed           = 115200
build_flags             = ${base.build_flags} 
    -D DEVICE_ID=95
    -D ARDUINO_USB_CDC_ON_BOOT=0
    -D ARDUINO_USB_MODE=1
lib_deps                = ${common.lib_deps}   

[env:esp32096]
upload_port             = /dev/cu.usbmodem*
extends                 = base
board                   = ${wemoss3minilolin.board}
build_flags             = ${base.build_flags} 
    -D DEVICE_ID=96
    -DBOARD_HAS_PSRAM
    -DARDUINO_USB_MODE=1
    -DARDUINO_USB_CDC_ON_BOOT=1

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