; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = 
    nodemcuv2-example-hello
;
; common options for all variants of iotsa
;
[common]
framework = arduino
lib_ldf_mode = deep+
lib_compat_mode = strict
lib_deps = 
    Adafruit NeoPixel
    ArduinoJson@7.2.1
    https://github.com/jackjansen/ArduinoJWT ; ArduinoJWT
    hirotakaster/CoAP simple library
    treboada/Ds1302
    littlefs
monitor_speed = 115200
extra_scripts = 
    pre:platformio_pre_script.py
;
; Debug options, copy or include with ${section.option} syntax
;
[use_debug_prints]
build_type = debug
monitor_filters = esp32_exception_decoder
; Very verbose prints from the core...
; build_flags =  -DCORE_DEBUG_LEVEL=6
; https debugging
; build_flags = -DHTTPS_LOGLEVEL=4
; NimBLE debugging
; build_flags = -DCONFIG_NIMBLE_CPP_DEBUG_LEVEL=4

[use_debugger]
debug_tool = minimodule
upload_protocol = minimodule

;
; per-processor options for variants of iotsa. Extends common options.
;

[esp8266]
extends = common
platform = espressif8266@4.0

[esp32_allvariants]
extends = common
platform = espressif32@6.9
lib_deps = 
    ${common.lib_deps}
    https://github.com/jackjansen/esp32_idf5_https_server
    https://github.com/jackjansen/esp32_idf5_https_server_compat
    h2zero/NimBLE-Arduino@^2.1.0
    madhephaestus/ESP32Encoder
    
lib_ignore = 
    ESP32 BLE Arduino

[esp32]
extends = esp32_allvariants
lib_deps = 
    ${esp32_allvariants.lib_deps}

[esp32c3]
extends = esp32_allvariants
# This enables the builtin esp32c3 serial-over-usb hardware to be used as Serial.
build_flags = -DESP32C3 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DIOTSA_SERIAL_SPEED=460800

[esp32_nonimble]
extends = esp32
lib_deps = 
    ${common.lib_deps}
    https://github.com/jackjansen/esp32_idf5_https_server_compat
    ESP32 BLE Arduino
lib_ignore = 
    h2zero/NimBLE-Arduino
;
; per-board options for variants of iotsa. Extends per-processor options.
;
[nodemcuv2]
extends = esp8266
board = nodemcuv2

[esp8285]
extends = esp8266
board = esp8285

[esp32thing]
extends = esp32
board = esp32thing

[esp32dev]
extends = esp32
board = esp32dev

[lolin32]
extends = esp32
board = lolin32
board_build.partitions = no_ota.csv ; BLE stack takes up a lot of space

[pico32]
extends = esp32
board = pico32

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

[esp32c3lcd]
extends = esp32c3
board = esp32-c3-devkitm-1
# board_build.flash_mode: dio
board_build.mcu = esp32c3
board_build.partitions = bare_minimum_2MB.csv
board_upload.flash_size = 2MB

[esp32c3supermini]
extends = esp32c3
board = esp32-c3-devkitm-1
board_build.mcu = esp32c3
board_build.partitions = min_spiffs.csv
board_upload.flash_size = 4MB

[example-hello]
build_src_filter = +<*> +<../examples/Hello>

[env:nodemcuv2-example-hello]
extends = nodemcuv2, example-hello

[env:esp32thing-example-hello]
extends = esp32thing, example-hello

[env:lolin32-example-hello]
extends = lolin32, example-hello

[env:esp32c3devkit-example-hello]
extends = esp32c3devkit, example-hello

[env:esp32c3lcd-example-hello]
extends = esp32c3lcd, example-hello

[example-HelloRights]
build_src_filter = +<*> +<../examples/HelloRights>

[env:nodemcuv2-example-HelloRights]
extends = nodemcuv2, example-HelloRights

[env:esp32thing-example-HelloRights]
extends = esp32thing, example-HelloRights

[example-HelloToken]
build_src_filter = +<*> +<../examples/HelloToken>

[env:nodemcuv2-example-HelloToken]
extends = nodemcuv2, example-HelloToken

[env:esp32thing-example-HelloToken]
extends = esp32thing, example-HelloToken

[example-input]
build_src_filter = +<*> +<../examples/Input>

[env:lolin32-example-input]
extends = lolin32, example-input

[env:esp32c3devkit-example-input]
extends = esp32c3devkit, example-input

[env:nodemcuv2-example-input]
extends = nodemcuv2, example-input

[example-skeleton]
build_src_filter = +<*> +<../examples/Skeleton>

[env:nodemcuv2-example-skeleton]
extends = nodemcuv2, example-skeleton
build_flags = -DWITH_NTP

[env:esp8285-example-skeleton]
extends = esp8285, example-skeleton
build_flags = -DIOTSA_WITH_COAP

[env:esp32thing-example-skeleton]
extends = esp32thing, example-skeleton
build_flags = -DIOTSA_WITH_BLE
board_build.partitions = min_spiffs.csv

[env:pico32-example-skeleton]
extends = pico32, example-skeleton
build_flags = -DWITH_NTP
board_build.partitions = min_spiffs.csv

[env:lolin32-example-skeleton-http]
extends = lolin32, example-skeleton
build_flags = -DIOTSA_WITHOUT_HTTPS

[env:lolin32-example-skeleton]
extends = lolin32, example-skeleton

[example-datetime]
build_src_filter = +<*> +<../examples/DateTime>

[env:pico32-example-datetime]
extends = pico32, example-datetime
build_flags = -DWITH_NTP
board_build.partitions = min_spiffs.csv

[env:nodemcuv2-example-datetime]
extends = nodemcuv2, example-datetime
build_flags = -DWITH_NTP

[example-bleled]
build_src_filter = +<*> +<../examples/BLELed>
; board_build.partitions = no_ota.csv
board_build.partitions = min_spiffs.csv

[env:nodemcuv2-example-bleled]
extends = nodemcuv2, example-bleled
build_flags = -DIOTSA_WITH_BLE

[env:nodemcuv2-example-bleled-nowifi]
extends = nodemcuv2, example-bleled
build_flags = -DIOTSA_WITHOUT_WIFI -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_API -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_COAP

[env:esp32thing-example-bleled]
extends = esp32thing, example-bleled
build_flags = -DIOTSA_WITH_BLE

[env:esp32dev-example-bleled]
extends = esp32dev, example-bleled
build_flags = -DIOTSA_WITH_BLE

[env:esp32c3devkit-example-bleled]
extends = esp32c3devkit, example-bleled
build_flags = -DIOTSA_BLE_DEBUG -DIOTSA_WITH_BLE -DNEOPIXEL_PIN=2 -DWITHOUT_VOLTAGE ${esp32c3devkit.build_flags}

[env:esp32c3lcd-example-bleled]
extends = esp32c3lcd, example-bleled
build_flags = -DIOTSA_BLE_DEBUG -DIOTSA_WITH_BLE -DNEOPIXEL_PIN=2 -DWITHOUT_VOLTAGE ${esp32c3lcd.build_flags}

[env:esp32c3supermini-example-bleled]
extends = esp32c3supermini, example-bleled
build_flags = -DIOTSA_BLE_DEBUG -DIOTSA_WITH_BLE -DNEOPIXEL_PIN=2 -DWITHOUT_VOLTAGE ${esp32c3supermini.build_flags}  -DIOTSA_DELAY_ON_BOOT=3 -DCONFIG_NIMBLE_CPP_DEBUG_LEVEL=4 -DCORE_DEBUG_LEVEL=6 -DIOTSA_BLE_DEBUG=1

[env:esp32thing-example-nonimbleled]
extends = esp32thing, example-bleled
build_flags = -DIOTSA_WITH_BLE -DIOTSA_WITHOUT_NIMBLE
lib_deps = 
    ${esp32thing.lib_deps}
    ESP32 BLE Arduino
lib_ignore = 
    h2zero/NimBLE-Arduino

[env:esp32thing-example-bleled-nowifi]
extends = esp32thing, example-bleled
build_flags = -DIOTSA_WITHOUT_WIFI -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_API -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_COAP

[env:lolin32-example-bleled]
extends = lolin32, example-bleled, use_debug_prints
; gpio15 on lolin32 can be used for minimodule debugging, so don't use it for LED.
build_flags = -DNEOPIXEL_PIN=16 -DIOTSA_WITH_BLE

[env:lolin32-example-bleled-coap]
extends = lolin32, example-bleled
; gpio15 on lolin32 can be used for minimodule debugging, so don't use it for LED.
build_flags = -DNEOPIXEL_PIN=16 -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITHOUT_REST -DIOTSA_WITH_BLE -DIOTSA_WITH_COAP -DCOAP_BUF_MAX_SIZE=1500

[env:lolin32-example-bleled-nowifi]
extends = lolin32, example-bleled
build_flags = -DIOTSA_WITHOUT_WIFI -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_API -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_COAP

[env:lolin32-example-bleled-kitchensink]
extends = lolin32, example-bleled
build_flags = -DIOTSA_WITH_BLE -DIOTSA_WITH_COAP -DIOTSA_WITH_HTTPS

[env:example-led]
build_src_filter = +<*> +<../examples/Led>

[env:lolin32-example-led]
extends = lolin32, example-led
