; 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
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp32
boards_dir = boards

[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip
platform_packages =
framework = arduino, espidf
board_build.embed_txtfiles =
    managed_components/espressif__esp_insights/server_certs/https_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt
build_type = release
custom_build = release
board_build.partitions = partitions.csv
build_unflags =
    -DCONFIG_BT_NIMBLE_LOG_LEVEL
    -DCONFIG_BTDM_BLE_SCAN_DUPL
    -DESP32
    -Werror=all
    -Wall
build_flags =
    -fexceptions
    -DESP_PLATFORM
    -DESP32
    -DARDUINO_ARCH_ESP32
    -DUSE_ESP_IDF_LOG
    -DCONFIG_BTDM_BLE_SCAN_DUPL=y
    -DNUKI_ALT_CONNECT
    -DBLESCANNER_USE_LATEST_NIMBLE
    -DNUKI_USE_LATEST_NIMBLE
    -DNUKI_NO_WDT_RESET
    -DNUKI_MUTEX_RECURSIVE
    -DNUKI_64BIT_TIME
    -DETH_SPI_SUPPORTS_NO_IRQ
    -Wno-ignored-qualifiers
    -Wno-missing-field-initializers
    -Wno-type-limits
    -Wno-maybe-uninitialized
    -Wno-implicit-fallthrough
    -Wno-unused-result
lib_deps =
    BleScanner=symlink://lib/BleScanner
lib_ignore =
    BLE
    BluetoothSerial
    SimpleBLE
    WiFiProv
    NimBLE-Arduino
    ESPAsyncTCP-esphome
    AsyncTCP_RP2040W
monitor_speed = 115200
monitor_filters =
	esp32_exception_decoder
	time

[env:esp32]
board = nuki-esp32dev
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32"
extra_scripts =
    pre:pio_package_pre.py
    post:pio_package_post.py
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0

[env:esp32-c3]
extends = env:esp32
board = esp32-c3-devkitc-02
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.singlecore.defaults"

[env:esp32-s3]
extends = env:esp32
board = nuki-esp32-s3
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32-s3"

[env:esp32-s3-oct]
extends = env:esp32
board = nuki-esp32-s3-oct
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32-s3-oct"

[env:esp32-c6]
extends = env:esp32
board = esp32-c6-devkitm-1
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.singlecore.defaults"

[env:esp32-h2]
extends = env:esp32
board = esp32-h2-devkitm-1
board_build.cmake_extra_args =
    -DNUKI_TARGET_H2=y
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.singlecore.defaults"
lib_ignore =
    BLE
    BluetoothSerial
    SimpleBLE
    WiFiProv
    NimBLE-Arduino
    ESPAsyncTCP-esphome
    AsyncTCP_RP2040W
    WiFiManager

[env:esp32-solo1]
extends = env:esp32
board = nuki-esp32solo1
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.singlecore.defaults;sdkconfig.defaults.esp32-solo1"

[env:esp32_dbg]
extends = env:esp32
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-c3_dbg]
extends = env:esp32-c3
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.singlecore.defaults"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-c6_dbg]
extends = env:esp32-c6
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.singlecore.defaults"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-h2_dbg]
extends = env:esp32-h2
custom_build = debug
board_build.cmake_extra_args =
    -DNUKI_TARGET_H2=y
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.singlecore.defaults"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-s3_dbg]
extends = env:esp32-s3
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32-s3"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-s3-oct_dbg]
extends = env:esp32-s3-oct
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32-s3-oct"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB

[env:esp32-solo1_dbg]
extends = env:esp32-solo1
custom_build = debug
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.singlecore.defaults;sdkconfig.defaults.esp32-solo1"
build_flags =
    ${env.build_flags}
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
    -DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
    -DCONFIG_BT_NIMBLE_LOG_LEVEL=0
    -DDEBUG_NUKIHUB