; 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 = updater_esp32
boards_dir = ../boards

[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.32/platform-espressif32.zip
platform_packages =
framework = arduino, espidf
build_type = release
custom_build = release
board_build.partitions = partitions.csv
build_unflags =
    -DESP32
    -Werror=all
    -Wall
build_flags =
    -fexceptions
    -DESP_PLATFORM
    -DESP32
    -DARDUINO_ARCH_ESP32
    -DUSE_ESP_IDF_LOG
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
    -DETH_SPI_SUPPORTS_NO_IRQ
    -DNUKI_HUB_UPDATER
    -Wno-ignored-qualifiers
    -Wno-missing-field-initializers
    -Wno-type-limits
    -Wno-maybe-uninitialized
    -Wno-implicit-fallthrough
    -Wno-unused-result
custom_component_remove =
    espressif/esp_hosted
    espressif/esp_wifi_remote
    espressif/esp_rainmaker
    espressif/rmaker_common
    espressif/esp_insights
    espressif/esp_diag_data_store
    espressif/esp_diagnostics
    espressif/esp-cbor
    espressif/esp-sr
    espressif/esp32-camera
    chmorgan/esp-libhelix-mp3
    espressif/eppp_link
    espressif/esp_modem
    espressif/esp_serial_slave_link
    espressif/esp-dsp
    espressif/esp-modbus
    espressif/network_provisioning
    joltwallet/littlefs
    espressif/esp-zboss-lib
    espressif/esp-zigbee-lib
    espressif/qrcode
lib_ignore =
    BLE
    BluetoothSerial
    SimpleBLE
    WiFiProv
lib_deps =
    PsychicHttp=symlink://../lib/PsychicHttp
    ArduinoJson=symlink://../lib/ArduinoJson
    DuoAuthLibrary=symlink://../lib/DuoAuthLibrary
    Arduino-Base32-Decode=symlink://../lib/Arduino-Base32-Decode
    Arduino-TOTP-RFC6238-generator=symlink://../lib/Arduino-TOTP-RFC6238-generator
    ESP32Ping=symlink://../lib/ESP32Ping
monitor_speed = 115200
monitor_filters =
	esp32_exception_decoder
	time

[env:updater_esp32]
board = nuki-esp32dev
extra_scripts =
     pre:pio_package_pre.py
     post:pio_package_post.py
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32"
build_flags =
    ${env.build_flags}
    -DNUKI_HUB_HTTPS_SERVER

[env:updater_esp32-nopsram]
board = nuki-esp32dev-nopsram
extra_scripts =
     pre:pio_package_pre.py
     post:pio_package_post.py
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-nopsram"
build_flags =
    ${env.build_flags}

[env:updater_esp32-gl-s10]
extends = env:updater_esp32
board = nuki-esp32gls10
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32;sdkconfig.defaults.gls10"
build_flags =
    ${env:updater_esp32.build_flags}
    -DNUKI_TARGET_GL_S10=y

[env:updater_esp32-c3]
extends = env:updater_esp32
board = esp32-c3-devkitc-02
build_flags =
    ${env.build_flags}

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

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

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

[env:updater_esp32-c6]
extends = env:updater_esp32
board = esp32-c6-devkitm-1
build_flags =
    ${env:updater_esp32.build_flags}
    -DFORCE_NUKI_HUB_HTTPS_SERVER

[env:updater_esp32-c5]
extends = env:updater_esp32
board_build.partitions = partitions_c5.csv
board = nuki-esp32-c5
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-c5"

[env:updater_esp32-p4]
extends = env:updater_esp32
board_build.embed_txtfiles =
board = esp32-p4
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-p4"
custom_component_remove =
    espressif/esp_rainmaker
    espressif/rmaker_common
    espressif/esp_insights
    espressif/esp_diag_data_store
    espressif/esp_diagnostics
    espressif/esp-cbor
    espressif/esp-sr
    espressif/esp32-camera
    chmorgan/esp-libhelix-mp3
    espressif/eppp_link
    espressif/esp_modem
    espressif/esp_serial_slave_link
    espressif/esp-dsp
    espressif/esp-modbus
    espressif/network_provisioning
    joltwallet/littlefs
    espressif/esp-zboss-lib
    espressif/esp-zigbee-lib
    espressif/qrcode

[env:updater_esp32-p4c5]
extends = env:updater_esp32-p4
board = nuki-esp32-p4-c5
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-p4;sdkconfig.defaults.esp32-p4c5"
    -DNUKI_TARGET_P4_C5=y

[env:updater_esp32-h2]
extends = env:updater_esp32
board = esp32-h2-devkitm-1
board_build.cmake_extra_args =
    -DNUKI_TARGET_H2=y
build_flags =
    ${env.build_flags}

[env:updater_esp32-solo1]
extends = env:updater_esp32
board = nuki-esp32solo1
board_build.cmake_extra_args =
    -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-solo1"
build_flags =
    ${env.build_flags}