[platformio]
default_envs = esp32030
; default_envs = esp32027, esp32029, esp32030 


;CHANGE THE VERSION BELOW !!!!!!
[program_customisation]
version = "3.10.1"
client  = "yourname"

; END OF GENERAL CUSTOMISATION

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

[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 =
    WiFi
    knolleary/PubSubClient @ ^2.8
    bblanchon/ArduinoJson @ ^6.19.4
    ; esphome/AsyncTCP-esphome@^1.2.2
    esphome/AsyncTCP-esphome@2.0.0

    esphome/ESPAsyncWebServer-esphome@^2.1.0
    ayushsharma82/AsyncElegantOTA @ ^2.2.7
    ottowinter/ESPAsyncTCP-esphome @ ^1.2.3
    Update
    amcewen/HttpClient @ ^2.2.0

    ; added as missing deps
    Wire
    adafruit/Adafruit Unified Sensor @ ^1.1.7
    adafruit/Adafruit BusIO @ ^1.14.1
    SPI

    ; mini web serial
    asjdf/WebSerialLite @ ^2.0.0

    ; button
    spacehuhn/SimpleButton @ 0.0.0-alpha+sha.026bc1e41a

    ; influxdb
    tobiasschuerg/ESP8266 Influxdb @ ^3.13.0

    ; BMP280
    adafruit/Adafruit BMP280 Library @ ^2.6.6

    ; MHZ19
    wifwaf/MH-Z19 @ ^1.5.4
    plerup/EspSoftwareSerial @ ^6.17.1

    ; LoRa
    sandeepmistry/LoRa @ ^0.8.0

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

; my common libraries
lib_extra_dirs =
    ~/3-Programming/02-Platformio/0-common-libs

; =========================================================================================================
; 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

[esp32wrover]
board=esp-wrover-kit

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

[esp32s3]
board = esp32-s3-devkitc-1

[wemoss3minilolin]
board = lolin_s3_mini

[env]
upload_speed = 921600
monitor_speed = 115200
extra_scripts = ${scripts_defaults.extra_scripts}

[base]
monitor_filters         = ${common.monitor_filters}
platform                = ${common.platform}
framework               = ${common.framework}
lib_deps                = ${common.lib_deps}
build_flags             = ${common.build_flags}
lib_extra_dirs          = ${common.lib_extra_dirs}

; ********************* PRODUCTION boards definition start here *********************
; env=hostname!!! important!!!

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

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


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


; ************************************* TESTS ***********************************************

; wrover OK
; [env:esp32045]
; extends                 = base
; board                   = ${esp32wrover.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=45'
;     -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
; board_build.partitions = huge_app.csv

; esp32s OK
; [env:esp32029]
; extends                 = base
; board                   = ${esp32.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=29'

; ; esp32s2 OK
; [env:esp32092]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=92'

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


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


; ************************************* C L I E N T S ***********************************************
; [env:krz101]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=101'

; [env:krz103]
; extends                 = base
; board                   = ${esp32s2.board}
; build_flags             = ${base.build_flags} '-D DEVICE_ID=103'