; PlatformIO Project Configuration File
; Please visit documentation: https://docs.platformio.org/page/projectconf.html

[platformio]
# ------------------------------------------------------------------------------
# ENVIRONMENTS
#
# Please uncomment one of the lines below to select your board(s)
# (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example)
# ------------------------------------------------------------------------------

# CI binaries
;; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth # ESP32 variant builds are temporarily excluded from CI due to toolchain issues on the GitHub Actions Linux environment
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi

# Release binaries
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB

# Build everything
; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0_6-rev2, codm-controller-0_6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips

# Single binaries (uncomment your board)
; default_envs = elekstube_ips
; default_envs = nodemcuv2
; default_envs = esp8266_2m
; default_envs = esp01_1m_full
; default_envs = esp07
; default_envs = d1_mini
; default_envs = heltec_wifi_kit_8
; default_envs = h803wf
; default_envs = d1_mini_debug
; default_envs = d1_mini_ota
; default_envs = esp32dev
; default_envs = esp8285_4CH_MagicHome
; default_envs = esp8285_H801
; default_envs = d1_mini_5CH_Shojo_PCB
; default_envs = wemos_shield_esp32
; default_envs = m5atom
; default_envs = esp32_eth
; default_envs = esp32dev_qio80
; default_envs = esp32_eth_ota1mapp
; default_envs = esp32s2_saola
; default_envs = esp32c3dev
; default_envs = lolin_s2_mini
; default_envs = esp32s3dev_16MB_PSRAM_opi

; MoonModules entries
; ===================

default_envs = 
; Netmindz: Disable the non-V4 envs as we only build using V4 now, TBC if we rename thr _V4 to be without and delete existing
;  or maintain the _V4 as we have "trained" our users that certain things are _V4 only plus the bootloader issue if you OTA from V3 to a V4

  ; esp32_4MB_S       ;; experimental, optimized for speed
  ; esp32_4MB_M       ;; esp32 recommended default
  ; esp32_4MB_M_eth
  ; esp32_4MB_M_debug
  ; esp32_4MB_XL
  ; ; esp32_16MB_S    ;; experimental, optimized for speed
  ; esp32_16MB_M      ;; esp32 recommended for boards with 16MB flash
  ; esp32_16MB_M_eth
  ; ; esp32_16MB_M_debug
  ; ; esp32_16MB_XL
  ; esp32_pico_4MB_M
  ;;
  ; wemos_shield_esp32_4MB_M
  ; wemos_shield_esp32_4MB_ICS4343x_M
  ; wemos_shield_esp32_4MB_SPM1423_M
  ; wemos_shield_esp32_4MB_LineIn_M
  ; wemos_shield_esp32_16MB_M
  ; wemos_shield_esp32_16MB_ICS4343x_M
  ; wemos_shield_esp32_16MB_SPM1423_M
  ; wemos_shield_esp32_16MB_SPM1423_XL
  ; wemos_shield_esp32_16MB_LineIn_M
  ;;
  esp32_4MB_V4_M           ;; esp32 4MB standard - HUB75 not included
  esp32dev_compat          ;; legacy
  esp32_pico_4MB_V4_S      ;; PICO D4 board
  esp32_4MB_V4_S_HUB75     ;; esp32 4MB  - HUB75 supported
  esp32_4MB_V4_HUB75_forum ;; esp32 4MB  - HUB75 supported (forum pinout)
  esp32_4MB_M_eth          ;; esp32 4MB with ethernet support
  esp32_4MB_V4_S_eth       ;; esp32 4MB "V4" build with ethernet support
  ; esp32_4MB_PSRAM_REV3_S ;; WROVER-E experimental, optimized for WROVER-E with "revision3" chip
  esp32_4MB_PSRAM_S        ;; esp32 WROVER with PSRAM; HUB75 supported
  esp32_16MB_V4_S          ;; esp32 16MB - HUB75 supported, optimized for speed
  esp32_16MB_V4_M          ;; esp32 16MB - HUB75 supported
  esp32_16MB_V4_M_debug    ;; esp32 16MB - for out-of-the-box debugging
  ;;
  esp32S3_4MB_S            ;; experimental, for HD-WF2 (HUB75 supported)
  esp32S3_8MB_S            ;; experimental, optimized for speed, HUB75 supported
  ;; esp32S3_8MB_M         ;; HUB75 supported
  esp32S3_4MB_PSRAM_S      ;; for lolin s3 mini, S3 zero, S3 super mini - optimized for speed (no HUB75 support)
  esp32S3_4MB_PSRAM_M      ;; for lolin s3 mini, S3 zero, S3 super mini (no HUB75 support)
  esp32S3_8MB_PSRAM_M      ;; for S3 with 8MB flash, HUB75 supported
  esp32S3_16MB_PSRAM_M_HUB75  ;; for S3 with 16MB flash, HUB75 supported (MOONHUB HUB75 adapter board)
  esp32S3_WROOM-2_M        ;; for S3 WROOM-2; HUB75 supported
  ;;
  esp32s2_PSRAM_S          ;; OTA-compatible with upstream
  esp32s2_PSRAM_M          ;; for lolin S2 mini
  ;; esp32s2_tinyUF2_PSRAM_S  ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!!
  ;;
  esp32c3dev_2MB_M         ;; experimental - 2MB Flash, no OTA
  esp32c3dev_4MB_M         ;; experimental
  esp32c3mini_dio_4MB_M    ;; for boards that need "dio" flash mode (instead of qio)
  ;; seeed_esp32c3_4MB_S   ;; experimental
  ;;
  esp8266_2MB_S
  esp8266_4MB_S     ;; recommended for 8266 with audio sync
  esp8266_4MB_M
  ; esp8266pro_16MB_S
  esp8266pro_16MB_M
  ;; esp01_1MB_S
  ;;
  ;; special boards
  abc_wled_controller_v43_V4_S
  athom_music_esp32_4MB_V4_M
  adafruit_matrixportal_esp32s3  ;;  HUB75 supported, uses standard bootloader
  ; adafruit_matrixportal_esp32s3_tinyUF2 ;;  supports the adafruit "tinyUF2" bootloader

; Go to MoonModules environments for environments


src_dir  = ./wled00
data_dir = ./wled00/data
build_cache_dir = ~/.platformio/buildcache
extra_configs =
  platformio_override.ini

[common]
# ------------------------------------------------------------------------------
# PLATFORM:
#   !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266
#
#   arduino core 2.6.3 = platformIO 2.3.2
#   arduino core 2.7.0 = platformIO 2.5.0
# ------------------------------------------------------------------------------
arduino_core_3_1_2 = espressif8266@4.2.1

# Development platforms
arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop
arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage

# Platform to use for ESP8266
platform_wled_default = ${common.arduino_core_3_1_2}
# We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization
#platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7
platform_packages = platformio/toolchain-xtensa @ ~2.100300.220621 #2.40802.200502
                    platformio/tool-esptool #@ ~1.413.0
                    platformio/tool-esptoolpy #@ ~1.30000.0


# ------------------------------------------------------------------------------
# FLAGS: DEBUG
# esp8266 : see https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level
# esp32   : see https://docs.platformio.org/en/latest/platforms/espressif32.html#debug-level
# ------------------------------------------------------------------------------
debug_flags = -D DEBUG=1 -D WLED_DEBUG
  -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM ;; for esp8266
  -DARDUINOJSON_DEBUG=1 ;; WLEDMM: this enables some debug asserts in arduinoJSON
  # if needed (for memleaks etc) also add; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
  # -DDEBUG_ESP_CORE is not working right now

# ------------------------------------------------------------------------------
# FLAGS: ldscript (available ldscripts at https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld)
#    ldscript_2m1m (2048 KB) = 1019 KB sketch, 4 KB eeprom, 1004 KB spiffs, 16 KB reserved
#    ldscript_4m1m (4096 KB) = 1019 KB sketch, 4 KB eeprom, 1002 KB spiffs, 16 KB reserved, 2048 KB empty/ota?
#
# Available lwIP variants (macros):
#    -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH  = v1.4 Higher Bandwidth (default)
#    -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY       = v2 Lower Memory
#    -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH = v2 Higher Bandwidth
#    -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
#
# BearSSL performance:
#  When building with -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL, please add `board_build.f_cpu = 160000000` to the environment configuration
#
# BearSSL ciphers:
#   When building on core >= 2.5, you can add the build flag -DBEARSSL_SSL_BASIC in order to build BearSSL with a limited set of ciphers:
#     TLS_RSA_WITH_AES_128_CBC_SHA256 / AES128-SHA256
#     TLS_RSA_WITH_AES_256_CBC_SHA256 / AES256-SHA256
#     TLS_RSA_WITH_AES_128_CBC_SHA / AES128-SHA
#     TLS_RSA_WITH_AES_256_CBC_SHA / AES256-SHA
#  This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
# ------------------------------------------------------------------------------
build_flags =
  -Wno-attributes
  -DMQTT_MAX_PACKET_SIZE=1024
  -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL
  -DBEARSSL_SSL_BASIC
  -D CORE_DEBUG_LEVEL=0
  ;; WLEDMM espressif docs say NDEBUG is not recommended. see https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32/api-guides/performance/speed.html#not-recommended
  -D NDEBUG  ;; however it  seems neecessary for non-V4 builds, to avoid spurious "assert" crashes inside the wifi core.
  -Wno-attributes ;; silence warnings about unknown attribute 'maybe_unused' in NeoPixelBus
  #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here)
  -D _IR_ENABLE_DEFAULT_=false
  -D DECODE_HASH=true
  -D DECODE_NEC=true
  -D DECODE_SONY=true
  -D DECODE_SAMSUNG=true
  -D DECODE_LG=true
  -D FASTLED_NO_FASTLED
  ;-Dregister= # remove warnings in C++17 due to use of deprecated register keyword by the FastLED library ;; warning: this breaks framework code on ESP32-C3 and ESP32-S2
  -DWLED_USE_MY_CONFIG
  ; -D USERMOD_SENSORSTOMQTT
  #For ADS1115 sensor uncomment following
  ; -D USERMOD_ADS1115

build_unflags =

build_flags_esp8266 = ${common.build_flags}  ${esp8266.build_flags}
build_flags_esp32   = ${common.build_flags}  ${esp32_idf_V4.build_flags}
build_flags_esp32_V4= ${common.build_flags}  ${esp32_idf_V4.build_flags}

ldscript_1m128k = eagle.flash.1m128.ld
ldscript_2m512k = eagle.flash.2m512.ld
ldscript_2m1m = eagle.flash.2m1m.ld
ldscript_4m1m = eagle.flash.4m1m.ld

;; WLEDMM: additional partion layouts for 8266 "pro" with 8MB or 16MB. On 8266 the max program size is always 1MB
ldscript_auto = eagle.flash.auto.ld
ldscript_8m6m = eagle.flash.8m6m.ld
ldscript_16m14m = eagle.flash.16m14m.ld

[scripts_defaults]
extra_scripts =
  pre:pio-scripts/set_version.py
  pre:pio-scripts/set_nightly_version.py
  pre:pio-scripts/build_ui.py
  pre:pio-scripts/conditional_usb_mode.py
  pre:pio-scripts/set_repo.py
  post:pio-scripts/output_bins.py
  post:pio-scripts/strip-floats.py
  pre:pio-scripts/user_config_copy.py
  ; post:pio-scripts/obj-dump.py  ;; convenience script to create a disassembly dump of the firmware (hardcore debugging)

# ------------------------------------------------------------------------------
# COMMON SETTINGS:
# ------------------------------------------------------------------------------
[env]
framework = arduino
board_build.flash_mode = dout
monitor_speed = 115200
# slow upload speed (comment this out with a ';' when building for development use)
upload_speed = 115200
# fast upload speed (remove ';' when building for development use)
; upload_speed = 921600

# ------------------------------------------------------------------------------
# LIBRARIES: required dependencies
#   Please note that we don't always use the latest version of a library.
#
#   The following libraries have been included (and some of them changed) in the source:
#     ArduinoJson@5.13.5, E131@1.0.0(changed), Time@1.5, Timezone@1.2.1
# ------------------------------------------------------------------------------
lib_compat_mode = strict
lib_deps =
    ;;fastled/FastLED @ 3.6.0 ;; default from upstream WLED
    fastled/FastLED @ 3.7.1   ;; needed to prevent compiler errors when using newer framework versions
    ;; https://github.com/softhack007/FastLED.git#ESP32-C6 ;; patched version needed for -C6
    IRremoteESP8266 @ 2.8.2
    ;;makuna/NeoPixelBus @ 2.7.9 ;; WLEDMM will be added in board specific sections
    ;;makuna/NeoPixelBus @ 2.8.3
    https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2
    bitbank2/AnimatedGIF@^1.4.7
    https://github.com/Aircoookie/GifDecoder.git#bc3af189b6b1e06946569f6b4287f0b79a860f8e
  #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
    #TFT_eSPI
  #For compatible OLED display uncomment following
    #U8g2 #@ ~2.33.15
  #For Dallas sensor uncomment following
    #OneWire @ ~2.3.7
  #For BME280 sensor uncomment following
    #BME280 @ ~3.0.0
    ; adafruit/Adafruit BMP280 Library @ 2.1.0
    ; adafruit/Adafruit CCS811 Library @ 1.0.4
    ; adafruit/Adafruit Si7021 Library @ 1.4.0
  #For ADS1115 sensor uncomment following
    ; adafruit/Adafruit BusIO @ 1.13.2
    ; adafruit/Adafruit ADS1X15 @ 2.4.0

extra_scripts = ${scripts_defaults.extra_scripts}

[esp8266]
build_unflags = ${common.build_unflags}
  -D WLED_ENABLE_GIF  ;; GIF support not possible - 8266 does not have enough RAM
build_flags =
  -DESP8266
  -DFP_IN_IROM
  ;-Wno-deprecated-declarations
  ;-Wno-register  ;; leaves some warnings when compiling C files: command-line option '-Wno-register' is valid for C++/ObjC++ but not for C
  ;-Dregister= # remove warnings in C++17 due to use of deprecated register keyword by the FastLED library ;; warning: this can be dangerous
  -Wno-misleading-indentation
  ; NONOSDK22x_190703 = 2.2.2-dev(38a443e)
  -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
  ; lwIP 2 - Higher Bandwidth no Features
  ;  -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
  ; lwIP 1.4 - Higher Bandwidth (Aircoookie has)
  -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
  ; VTABLES in Flash
  -DVTABLES_IN_FLASH
  ; restrict to minimal mime-types
  -DMIMETYPE_MINIMAL
  ; other special-purpose framework flags (see https://docs.platformio.org/en/latest/platforms/espressif8266.html)
  ; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;; in case of linker errors like "section `.text1' will not fit in region `iram1_0_seg'"
  ; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED ;; (experimental) adds some extra heap, but may cause slowdown
  -D USERMOD_AUDIOREACTIVE
  -D NON32XFER_HANDLER ;; ask forgiveness for PROGMEM misuse
  -D WLED_DISABLE_PARTICLESYSTEM2D
  -D WLED_DISABLE_PIXELFORGE ;; not enought space in flash
  -D WLED_USE_SHARED_RMT                                  ;; don't use the RMTHI driver (not compatible with esp8266)

;; special library dependencies for 8266 (workaround for upsteam #5136) - replaces env.lib_deps
lib8266_deps =
    fastled/FastLED @ 3.6.0   ;; default from upstream WLED
    IRremoteESP8266 @ 2.8.2
    https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.2.1  ;; use proven version for 8266
    ;; bitbank2/AnimatedGIF@^1.4.7
    ;; https://github.com/Aircoookie/GifDecoder.git#bc3af189b6b1e06946569f6b4287f0b79a860f8e

lib_deps =
  #https://github.com/lorol/LITTLEFS.git
  ESPAsyncTCP @ 1.2.2
  ESPAsyncUDP
  ;; makuna/NeoPixelBus @ 2.6.9 ;; WLEDMM use if you have problems with 2.7.5
  makuna/NeoPixelBus @ 2.7.5
  ${esp8266.lib8266_deps}           ;; use proven library versions for 8266
lib_ignore =
   NeoESP32RmtHI

;; compatibilty flags - same as 0.14.0 which seems to work better on some 8266 boards. Not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
build_flags_compat =
  -DESP8266
  -DFP_IN_IROM
  ;;-Wno-deprecated-declarations
  -Wno-misleading-indentation
  ;;-Wno-attributes ;; silence warnings about unknown attribute 'maybe_unused' in NeoPixelBus
  -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
  -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
  -DVTABLES_IN_FLASH
  -DMIMETYPE_MINIMAL
  -DWLED_SAVE_IRAM ;; needed to prevent linker error
  -D WLED_USE_SHARED_RMT                                  ;; don't use the RMTHI driver (not compatible with esp8266)

;; this platform version was used for WLED 0.14.0
platform_compat = espressif8266@4.2.0
platform_packages_compat =
                    platformio/toolchain-xtensa @ ~2.100300.220621 #2.40802.200502
                    platformio/tool-esptool #@ ~1.413.0
                    platformio/tool-esptoolpy #@ ~1.30000.0


;; old V3 platform for esp32. Can be a fallback option when hitting flash size limits
[esp32_legacy]
platform = espressif32@3.5.0
platform_packages = framework-arduinoespressif32 @ https://github.com/Aircoookie/arduino-esp32.git#1.0.6.4
build_unflags = ${common.build_unflags}
  -Wshadow=compatible-local ;; not supported by older compilers
  ;; -D CORE_DEBUG_LEVEL=0 -DNDEBUG ;; enable core debugging
build_flags = -g
  -Wno-unused-variable -Wno-unused-function ;; removes noise
  -DARDUINO_ARCH_ESP32
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472                ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=9472
  -D LOROL_LITTLEFS                                       ;; use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
  -D WLED_USE_SHARED_RMT                                  ;; don't use the RMTHI driver (not compatible with esp-idf v3.x)
  ;; -D CORE_DEBUG_LEVEL=5 ;; enable core debug messages
  ;; -DDEBUG -DWLED_DEBUG   ;; enable WLED debug messages
lib_deps =
  esp32async/AsyncTCP @ 3.4.7
  ; https://github.com/lorol/LITTLEFS.git
  https://github.com/softhack007/LITTLEFS-threadsafe.git#master  ;; WLEDMM specific: patched version of lorol LittleFS with improved thread safety
  makuna/NeoPixelBus @ 2.7.5
  ;; makuna/NeoPixelBus @ 2.7.9 ;; experimental
  ${env.lib_deps}
lib_ignore =
   NeoESP32RmtHI
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}      ;; default partioning for 4MB Flash - can be overridden in build envs
default_partitions = ${esp32.default_partitions}          ;; backwards compatibility
board_build.f_flash = 80000000L
board_build.flash_mode = dout                             ;; avoid dio/quot/qio - these are broken in arduino-esp32 1.0.6.x
;;board_build.flash_mode = dio
; RAM:   [==        ]  24.2% (used 79284 bytes from 327680 bytes)
; Flash: [========= ]  93.1% (used 1464961 bytes from 1572864 bytes)

;; standard platform for esp32
[esp32]
platform             = ${esp32_idf_V4.platform}           ;; default = tasmota (= default from esp32_idf_V4)
platform_packages    = ${esp32_idf_V4.platform_packages}
build_flags          = ${esp32_idf_V4.build_flags}

default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv      ;; WLED standard for 4MB flash: 1.4MB firmware, 1MB filesystem
;default_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv   ;; WLEDMM alternative for 4MB flash:   1.8MB firmware, 256KB filesystem (esptool erase_flash needed before changing)

tiny_partitions = tools/WLED_ESP32_2MB_noOTA.csv
extended_partitions = tools/WLED_ESP32_4MB_700k_FS.csv
big_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv     ;; 1.8MB firmware, 256KB filesystem, coredump support
large_partitions = tools/WLED_ESP32_8MB.csv
extreme_partitions = tools/WLED_ESP32_16MB_9MB_FS.csv

lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder

;; Compatibility with upstream --> you should prefer using ${common_mm.build_flags_S} and ${common_mm.lib_deps_S}
AR_build_flags = ${common_mm.AR_build_flags}
AR_lib_deps = ${common_mm.AR_lib_deps}      ;; optimized version, 10% faster on -S2/-C3
board_build.partitions = ${esp32.default_partitions}   ;; default partioning for 4MB Flash - can be overridden in build envs
board_build.f_flash = 80000000L
board_build.flash_mode = dio

;; WLEDMM begin

;; tasmota platform - reduces firmaware size by ~280KB
platformTasmota = https://github.com/tasmota/platform-espressif32/releases/download/2023.06.02/platform-espressif32.zip ;; Tasmota Arduino Core 2.0.9 with IPv6 support, based on IDF 4.4.4
platform_packagesTasmota =

;; ** For compiling with latest Frameworks (IDF4.4.x and arduino-esp32 v2.0.x) **
;;; previous standard V4 platform
platformV4_pre = espressif32@5.2.0
platformV4_packages_pre =
  toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 ; required for platform version < 5.3.0, remove this line when upgrading to platform >=5.3.0
;;; standard V4 platform
platformV4 = espressif32@ ~6.3.2
platformV4_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them)

;;; experimental: latest V4 platform with latest arduino-esp32 2.0.14 + ESP-IDF 4.4.6 (may or may not work)
platformV4_xp = espressif32@ ~6.5.0
platformV4_packages_xp = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14

build_flagsV4 = -g
  -DARDUINO_ARCH_ESP32 -DESP32
  -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472              ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=9472                   ;; *sigh* newer asyncTCP uses this instead of .._TASK_..
  ; -D WLEDMM_TWOPATH  ;; use I2S1 as the second bus --> slightly faster on some setups
  ; -D WLEDMM_SLOWPATH ;; don't use I2S for LED bus
  ; -DARDUINO_USB_CDC_ON_BOOT=0 ;; mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
  -D NO_GFX ; Disable the use of Adafruit_GFX by the HUB75 driver

;;; V4.4.x libraries (without LOROL_LITTLEFS; with newer NeoPixelBus)
lib_depsV4 =
  esp32async/AsyncTCP @ 3.4.7
  makuna/NeoPixelBus @ 2.7.9 ;; experimental
  ${common_mm.HUB75_lib_deps}
  ${env.lib_deps}


;; WLEDMM end

[esp32_idf_V4]
;; please note that you can NOT update existing ESP32 installs with a "V4" build. Also updating by OTA will not work properly.
;; You need to completely erase your device (esptool erase_flash) first, then install the "V4" build from VSCode+platformio.
;; uses arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them)

;; standard platform - RECOMMENDED for debugging! The tasmota platform has removed all kernel error reporting code
;; platform = espressif32@ ~6.3.2
;; platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them)

;; Tasmota Arduino Core 2.0.9 with IPv6 support, based on IDF 4.4.4.  Warning: all kernel error asserts removed
platform = ${esp32.platformTasmota}
platform_packages = ${esp32.platform_packagesTasmota}

build_unflags = ${common.build_unflags}
build_flags = -g
  -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
  -DARDUINO_ARCH_ESP32 -DESP32
  #-DCONFIG_LITTLEFS_FOR_IDF_3_2
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472              ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=9472                   ;; *sigh* newer asyncTCP uses this instead of .._TASK_..
  -DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
  ; -D WLEDMM_TWOPATH  ;; use I2S1 as the second bus --> slightly faster on some setups
  ; -D WLEDMM_SLOWPATH ;; don't use I2S for LED bus
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
lib_deps =
  esp32async/AsyncTCP @ 3.4.7
  makuna/NeoPixelBus @ 2.7.9 ;; experimental
  ${env.lib_deps}
board_build.partitions = ${esp32.default_partitions}   ;; default partioning for 4MB Flash - can be overridden in build envs
monitor_filters = esp32_exception_decoder
board_build.f_flash = 80000000L
board_build.flash_mode = dio

[esp32s2]
;; generic definitions for all ESP32-S2 boards
;; platform = espressif32@5.2.0
;; platform_packages =
;;  toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
;;  toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
;; standard espressif platform
;; platform = espressif32@ ~6.3.2
;; platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0    ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them)
;; inherit tasmota platform from esp32_idf_V4
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
board_build.flash_mode = dio   ;; prevents build error:  sdkconfig.h: No such file or directory

build_flags = -g
  -DARDUINO_ARCH_ESP32 -DESP32                     ;; WLEDMM
  -DARDUINO_ARCH_ESP32S2
  -DCONFIG_IDF_TARGET_ESP32S2=1
  -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE   ;; WLEDMM
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=8614         ;; WLEDMM increase stack by 1Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=8614                   ;; *sigh* newer asyncTCP uses this instead of .._TASK_..
  -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
  -DCO
  -DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
  ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
  ;; ARDUINO_USB_CDC_ON_BOOT
  ; -D WLED_USE_SHARED_RMT ;; un-comment to use the standard RMT driver instead of RMTHI

lib_deps =
  esp32async/AsyncTCP @ 3.4.7
  makuna/NeoPixelBus @ 2.7.9 ;; experimental - reduces LED glitches on -S2
  ${env.lib_deps}
board_build.partitions = ${esp32.default_partitions}   ;; default partioning for 4MB Flash - can be overridden in build envs
monitor_filters = esp32_exception_decoder

[esp32c3]
;; generic definitions for all ESP32-C3 boards
;; inherit tasmota platform from esp32_idf_V4
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = -g
  -DARDUINO_ARCH_ESP32 -DESP32                     ;; WLEDMM
  -DARDUINO_ARCH_ESP32C3
  -DCONFIG_IDF_TARGET_ESP32C3=1
  -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE   ;; WLEDMM
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472         ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=9472                   ;; *sigh* newer asyncTCP uses this instead of .._TASK_..
  -DCO
  -DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
  ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
  ;; ARDUINO_USB_CDC_ON_BOOT
  -D WLED_USE_SHARED_RMT                           ;; don't use the RMTHI driver (not compatible with -C3)

lib_deps =
  esp32async/AsyncTCP @ 3.4.7
  makuna/NeoPixelBus @ 2.7.9 ;; experimental
  ${env.lib_deps}
lib_ignore =
   NeoESP32RmtHI
board_build.partitions = ${esp32.default_partitions}   ;; default partioning for 4MB Flash - can be overridden in build envs
monitor_filters = esp32_exception_decoder

[esp32s3]
;; generic definitions for all ESP32-S3 boards
;; inherit tasmota platform from esp32_idf_V4
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = -g
  -DESP32
  -DARDUINO_ARCH_ESP32
  -DARDUINO_ARCH_ESP32S3
  -DCONFIG_IDF_TARGET_ESP32S3=1
  -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE   ;; WLEDMM
  -DWLEDMM_NO_SERIAL_WAIT                          ;; WLEDMM don't wait for serial on -S3 (unless WLED_DEBUG is set)
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472         ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE
  -D CONFIG_ASYNC_TCP_STACK_SIZE=9472                   ;; *sigh* newer asyncTCP uses this instead of .._TASK_..
  -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_DFU_ON_BOOT=0
  -DCO
  ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
  ;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT
  ;-D WLED_USE_SHARED_RMT ;; un-comment to use the standard RMT driver instead of RMTHI
lib_deps =
  esp32async/AsyncTCP @ 3.4.7
  makuna/NeoPixelBus @ 2.7.9 ;; experimental
  ${env.lib_deps}
board_build.partitions = ${esp32.large_partitions}   ;; default partioning for 8MB flash - can be overridden in build envs
monitor_filters = esp32_exception_decoder


# ------------------------------------------------------------------------------
# WLED BUILDS
# ------------------------------------------------------------------------------

[env:nodemcuv2]
board = nodemcuv2
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 #-DWLED_DISABLE_2D
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}
monitor_filters = esp8266_exception_decoder

[env:nodemcuv2_160]
extends = env:nodemcuv2
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266_160 #-DWLED_DISABLE_2D

[env:esp8266_2m]
board = esp_wroom_02
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:esp8266_2m_160]
extends = env:esp8266_2m
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02_160

;WLEDMM: see below
; [env:esp01_1m_full]
; board = esp01_1m
; platform = ${common.platform_wled_default}
; platform_packages = ${common.platform_packages}
; board_build.ldscript = ${common.ldscript_1m128k}
; build_unflags = ${common.build_unflags}
; build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA
;   ; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
; lib_deps = ${esp8266.lib_deps}
; [env:esp01_1m_full_160]
; extends = env:esp01_1m_full
; board_build.f_cpu = 160000000L
; build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01_160 -D WLED_DISABLE_OTA
;   ; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM

[env:esp07]
board = esp07
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:d1_mini]
board = d1_mini
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
upload_speed = 921600
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}
monitor_filters = esp8266_exception_decoder

[env:heltec_wifi_kit_8]
board = d1_mini
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:h803wf]
board = d1_mini
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

;; two aliases for lazy users
[env:esp32dev]
extends = env:esp32dev_V4
[env:esp32_wrover]
extends = env:esp32_4MB_PSRAM_S

;; legacy build for OTA compatibility with upstream 0.15.x, slow but safe
[env:esp32dev_compat]
extends = esp32_legacy
board = esp32dev
platform = ${esp32_legacy.platform}
platform_packages = ${esp32_legacy.platform_packages}
build_unflags = ${esp32_legacy.build_unflags}
build_flags =   ${common.build_flags} ${esp32_legacy.build_flags} -D WLED_RELEASE_NAME=ESP32_compat #-D WLED_DISABLE_BROWNOUT_DET
    ${esp32.AR_build_flags}
    ;;-D WLED_ENABLE_PIXART                     ;; 8KB Flash
    -D WLED_ENABLE_PIXELFORGE -DWLED_ENABLE_GIF ;; 30KB flash
    ;;-D WLED_ENABLE_FULL_FONTS                 ;; 10KB flash
lib_deps = ${esp32_legacy.lib_deps}
    ${esp32.AR_lib_deps}
board_build.partitions = ${esp32_legacy.default_partitions}
monitor_filters = esp32_exception_decoder
;; RAM:   [==        ]  23.2% (used 75944 bytes from 327680 bytes)
;; Flash: [========= ]  88.5% (used 1391917 bytes from 1572864 bytes)

;; legacy build for OTA compatibility with upstream 0.15.x, faster due to qio mode
[env:esp32dev_qio80_compat]
extends = esp32_legacy
board = esp32dev
platform = ${esp32_legacy.platform}
platform_packages = ${esp32_legacy.platform_packages}
build_unflags = ${esp32_legacy.build_unflags}
build_flags =   ${common.build_flags} ${esp32_legacy.build_flags} -D WLED_RELEASE_NAME=ESP32_qio80_compat #-D WLED_DISABLE_BROWNOUT_DET
    ${esp32.AR_build_flags}
lib_deps = ${esp32_legacy.lib_deps}
    ${esp32.AR_lib_deps}
board_build.partitions = ${esp32_legacy.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder

[env:esp32dev_V4]
board = esp32dev
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags =   ${common.build_flags}  ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_V4 #-D WLED_DISABLE_BROWNOUT_DET
    ${esp32.AR_build_flags}
lib_deps = ${esp32_idf_V4.lib_deps}
    ${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32_idf_V4.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = dio

;; alias name for env:esp32_4MB_M_eth; improves compatibility with old platformio_override.ini entries
[env:esp32_eth]
extends = env:esp32_4MB_M_eth

;; legacy build for OTA compatibility with upstream 0.15.x
;; --> use [env:esp32_4MB_M_eth] (4MB) or [env:esp32_16MB_M_eth] 
[env:esp32_eth_compat]
extends = esp32_legacy
board = esp32-poe
platform = ${esp32_legacy.platform}
platform_packages = ${esp32_legacy.platform_packages}
upload_speed = 921600
build_unflags = ${esp32_legacy.build_unflags}
build_flags =   ${common.build_flags} ${esp32_legacy.build_flags} -D WLED_RELEASE_NAME=ESP32_Ethernet_compat -D RLYPIN=-1 
  -D WLED_USE_ETHERNET -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 
  -D LEDPIN=4
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
    ;;-D WLED_ENABLE_PIXART                     ;; 8KB Flash
    -D WLED_ENABLE_PIXELFORGE -DWLED_ENABLE_GIF ;; 30KB flash
    ;;-D WLED_ENABLE_FULL_FONTS                 ;; 10KB flash
  ${esp32.AR_build_flags}
lib_deps = ${esp32_legacy.lib_deps}
  ${esp32.AR_lib_deps}
board_build.partitions = ${esp32_legacy.default_partitions}

;; WLEDMM: use WLEDMM build environments
;;[env:esp32s2_saola]
;;board = esp32-s2-saola-1
;;platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
;;platform_packages =
;;framework = arduino
;;board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
;;board_build.flash_mode = qio
;;upload_speed = 460800
;;build_unflags = ${common.build_unflags}
;;build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME=S2_saola
;;  ;-DLOLIN_WIFI_FIX ;; try this in case Wifi does not work
;;  -DARDUINO_USB_CDC_ON_BOOT=1
;; lib_deps = ${esp32s2.lib_deps}

;; WLEDMM: use WLEDMM build environments
;; [env:esp32_wrover]
;; extends = esp32_idf_V4
;; platform = ${esp32_idf_V4.platform}
;; platform_packages = ${esp32_idf_V4.platform_packages}
;; board = ttgo-t7-v14-mini32
;; board_build.f_flash = 80000000L
;; board_build.flash_mode = qio
;; board_build.partitions = ${esp32.extended_partitions}
;; build_unflags = ${common.build_unflags}
;; build_flags = ${common.build_flags_esp32_V4} -D WLED_RELEASE_NAME=ESP32_WROVER
;;  -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
;;  -D LEDPIN=25
;;  ; ${esp32.AR_build_flags}
;; lib_deps = ${esp32_idf_V4.lib_deps}
;;  ; ${esp32.AR_lib_deps}

[env:esp32c3dev]
extends = esp32c3
platform = ${esp32c3.platform}
platform_packages = ${esp32c3.platform_packages}
framework = arduino
board = esp32-c3-devkitm-1
board_build.partitions = ${esp32.default_partitions}
build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_RELEASE_NAME=ESP32_C3
  -D WLED_WATCHDOG_TIMEOUT=0
  -DLOLIN_WIFI_FIX ; seems to work much better with this
  -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
  ;-DARDUINO_USB_CDC_ON_BOOT=0   ;; for serial-to-USB chip
upload_speed = 460800
build_unflags = ${common.build_unflags}
lib_deps = ${esp32c3.lib_deps}
board_build.flash_mode = dio ;; some boards do not boot with the faster "qio" mode
; RAM:   [==        ]  24.0% (used 78624 bytes from 327680 bytes)
; Flash: [========= ]  91.7% (used 1441933 bytes from 1572864 bytes)

;; WLEDMM: use WLEDMM build environments
;; [env:esp32s3dev_8MB]
;; ESP32-S3-DevKitC-1 development board, with 8MB FLASH, no PSRAM (flash_mode: qio)
;; board = esp32-s3-devkitc-1
;; platform = ${esp32s3.platform}
;; platform_packages = ${esp32s3.platform_packages}
;; upload_speed = 921600 ; or  460800
;; build_unflags = ${common.build_unflags}
;; build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32_S3_8MB
;;   -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
;;   -D ARDUINO_USB_CDC_ON_BOOT=0  ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
;;   ;-D ARDUINO_USB_CDC_ON_BOOT=1 ;; -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
;;   ;-D WLED_DEBUG
;; lib_deps = ${esp32s3.lib_deps}
;;   ${esp32.AR_lib_deps}
;; board_build.partitions = ${esp32.large_partitions}
;; board_build.f_flash = 80000000L
;; board_build.flash_mode = qio
;; ; board_build.flash_mode = dio   ;; try this if you have problems at startup
;; monitor_filters = esp32_exception_decoder

;; only for testing.
;; [env:esp32s3dev_8MB_PSRAM_opi]
;;   ESP32-S3 development board, with 8MB FLASH and >= 8MB PSRAM (memory_type: qio_opi)
;; board = esp32-s3-devkitc-1 ;; generic dev board; the next lines add PSRAM support
;; board_build.flash_mode = qio
;; board_build.arduino.memory_type = qio_opi     ;; use with PSRAM: 8MB or 16MB
;; platform = ${esp32s3.platform}
;; platform_packages = ${esp32s3.platform_packages}
;; upload_speed = 921600
;; build_unflags = ${common.build_unflags}
;;   ; -DCORE_DEBUG_LEVEL=0
;;   ;;-DNDEBUG ;; removing this flag leads to a massive flood of runtime warnings from NeoPixelBus 2.7.9
;; build_flags = ${common.build_flags} ${esp32s3.build_flags}
;;   ; -DCORE_DEBUG_LEVEL=5
;;   ;;-DWLED_DEBUG ; -DDEBUG
;;   ; -D WLED_USE_SHARED_RMT ;; RMTHI causes interrupt watchdog reset - needs more investigation
;;   -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
;;   ;;-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1      ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
;;   -D WLED_RELEASE_NAME=ESP32_S3_PSRAM_opi
;;   -D BOARD_HAS_PSRAM -D WLED_USE_PSRAM ; tells WLED that PSRAM shall be used
;;   -D WLED_USE_PSRAM_JSON -D ALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
;; lib_deps = ${esp32s3.lib_deps}
;;    ${esp32.AR_lib_deps}
;; board_build.partitions = ${esp32.large_partitions}
;; board_build.f_flash = 80000000L
;; monitor_filters = esp32_exception_decoder

;; [env:esp32s3dev_16MB_PSRAM_opi]
;; extends = env:esp32s3dev_8MB_PSRAM_opi
;; board_build.partitions = tools/WLED_ESP32_16MB.csv
;; board_upload.flash_size = 16MB

;; [env:esp32s3dev_8MB_PSRAM_qspi]
;; ESP32-TinyS3 development board, with 8MB FLASH and PSRAM (memory_type: qio_qspi)
;; extends = env:esp32s3dev_8MB_PSRAM_opi
;; ;board = um_tinys3 ;    -> needs workaround from https://github.com/Aircoookie/WLED/pull/2905#issuecomment-1328049860
;; board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
;; board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or  4MB

[env:esp8285_4CH_MagicHome]
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:esp8285_H801]
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:d1_mini_5CH_Shojo_PCB]
board = d1_mini
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_USE_SHOJO_PCB
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

# ------------------------------------------------------------------------------
# DEVELOPMENT BOARDS
# ------------------------------------------------------------------------------

[env:d1_mini_debug]
board = d1_mini
build_type = debug
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} ${common.debug_flags}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:d1_mini_ota]
board = d1_mini
upload_protocol = espota
# exchange for your WLED IP
upload_port = "10.10.1.27"
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:anavi_miracle_controller]
board = d1_mini
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=12 -D IRPIN=-1 -D RLYPIN=2
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:lolin_s2_mini]
platform = ${esp32s2.platform}
platform_packages = ${esp32s2.platform_packages}
board = lolin_s2_mini
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio   ;; prevents build error:  sdkconfig.h: No such file or directory
build_unflags = ${common.build_unflags} #-DARDUINO_USB_CDC_ON_BOOT=1
;; board_build.flash_mode = qio
;; board_build.f_flash = 80000000L
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32_S2
  -DBOARD_HAS_PSRAM
  -DARDUINO_USB_CDC_ON_BOOT=1 # try disabling and enabling unflag above in case of board-specific issues, will disable Serial
  -DARDUINO_USB_MSC_ON_BOOT=0
  -DARDUINO_USB_DFU_ON_BOOT=0
  -DLOLIN_WIFI_FIX ; seems to work much better with this
  -D WLED_USE_PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  ; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 6792 bytes FLASH
  -D WLED_WATCHDOG_TIMEOUT=0
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D LEDPIN=16
  -D BTNPIN=18
  -D RLYPIN=9
  -D IRPIN=7
  -D HW_PIN_SCL=35
  -D HW_PIN_SDA=33
  -D HW_PIN_CLOCKSPI=7
  -D HW_PIN_MOSISPI=11 ;WLEDMM renamed from HW_PIN_DATASPI
  -D HW_PIN_MISOSPI=9
;  -D STATUSLED=15
lib_deps = ${esp32s2.lib_deps}

# ------------------------------------------------------------------------------
# custom board configurations
# ------------------------------------------------------------------------------

;; WLEDMM: use [env:esp32c3dev_2MB_M] (WLEDMM build environment)
;; [env:esp32c3dev_2MB]
;; ;; for ESP32-C3 boards with 2MB flash (instead of 4MB).
;; ;; this board need a specific partition file. OTA not possible.
;; extends = esp32c3
;; platform = ${esp32c3.platform}
;; platform_packages = ${esp32c3.platform_packages}
;; board = esp32-c3-devkitm-1
;; build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32_C3
;;   -D WLED_WATCHDOG_TIMEOUT=0
;;   -D WLED_DISABLE_OTA
;;   ; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
;;   -DARDUINO_USB_CDC_ON_BOOT=0   ;; for serial-to-USB chip
;; build_unflags = ${common.build_unflags}
;; upload_speed = 115200
;; lib_deps = ${esp32c3.lib_deps}
;; board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
;; board_build.flash_mode = dio
;; board_upload.flash_size = 2MB
;; board_upload.maximum_size = 2097152

;WLEDMM: see below
; [env:wemos_shield_esp32]
; board = esp32dev
; platform = ${esp32.platform}
; platform_packages = ${esp32.platform_packages}
; upload_speed = 460800
; build_unflags = ${common.build_unflags}
; build_flags = ${common.build_flags_esp32}
;   -D LEDPIN=16
;   -D RLYPIN=19
;   -D BTNPIN=17
;   -D IRPIN=18
;   -U WLED_USE_MY_CONFIG
;   -D USERMOD_DALLASTEMPERATURE
;   -D USERMOD_FOUR_LINE_DISPLAY
;   -D TEMPERATURE_PIN=23
;   -D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
;   -D USERMOD_AUDIOREACTIVE
; lib_deps = ${esp32.lib_deps}
;   OneWire@~2.3.5
;   olikraus/U8g2 @ ^2.28.8
;   https://github.com/blazoncek/arduinoFFT.git
; board_build.partitions = ${esp32.default_partitions}

[env:m5atom]
board = esp32dev
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
lib_deps = ${esp32.lib_deps}
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
board_build.partitions = ${esp32.default_partitions}

[env:sp501e]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m512k}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1
build_unflags = ${esp8266.build_unflags}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:sp511e]
board = esp_wroom_02
platform = ${common.platform_wled_default}
board_build.ldscript = ${common.ldscript_2m512k}
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
build_unflags = ${esp8266.build_unflags}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:Athom_RGBCW]        ;7w and 5w(GU10) bulbs
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,13,5
                                            -D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}


[env:Athom_15w_RGBCW]        ;15w bulb
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,5,13
                                            -D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0 -D WLED_USE_IC_CCT
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}


[env:Athom_3Pin_Controller]        ;small controller with only data
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 -D BTNPIN=0 -D RLYPIN=-1 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}


[env:Athom_4Pin_Controller]       ; With clock and data interface
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 -D BTNPIN=0 -D RLYPIN=12 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}


[env:Athom_5Pin_Controller]      ;Analog light strip controller
board = esp8285
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266 -D BTNPIN=0 -D RLYPIN=-1 DATA_PINS=4,12,14,13 -D WLED_DISABLE_INFRARED
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}


[env:MY9291]
board = esp01_1m
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA -D USERMOD_MY9291
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

# ------------------------------------------------------------------------------
# codm pixel controller board configurations
# codm-controller-0_6 can also be used for the TYWE3S controller
# ------------------------------------------------------------------------------

[env:codm-controller-0_6]
board = esp_wroom_02
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_2m512k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

[env:codm-controller-0_6-rev2]
board = esp_wroom_02
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_4m1m}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266}
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}

# ------------------------------------------------------------------------------
# EleksTube-IPS
# ------------------------------------------------------------------------------
[env:elekstube_ips]
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600
build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
  -D USERMOD_RTC
  -D USERMOD_ELEKSTUBE_IPS
  -D LEDPIN=12
  -D RLYPIN=27
  -D BTNPIN=34
  -D DEFAULT_LED_COUNT=6
  # Display config
  -D ST7789_DRIVER
  -D TFT_WIDTH=135
  -D TFT_HEIGHT=240
  -D CGRAM_OFFSET
  -D TFT_SDA_READ
  -D TFT_MOSI=23
  -D TFT_SCLK=18
  -D TFT_DC=25
  -D TFT_RST=26
  -D SPI_FREQUENCY=40000000
  -D USER_SETUP_LOADED
monitor_filters = esp32_exception_decoder
lib_deps =
  ${esp32.lib_deps}
  TFT_eSPI @ ^2.3.70
board_build.partitions = ${esp32.default_partitions}







# ------------------------------------------------------------------------------
# MoonModules environments
# see https://mm.kno.wled.ge/moonmodules/platformio-entries/
# ------------------------------------------------------------------------------

; shared build flags and lib deps for minimum and maximum environment
[common_mm]

build_disable_sync_interfaces =
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_INFRARED
  -D WLED_DISABLE_ADALIGHT  ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128)
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only

AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT ;; WLEDMM audioreactive usermod, licensed under EUPL-1.2
AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2      ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3

animartrix_build_flags = -D USERMOD_ANIMARTRIX ;; WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick
animartrix_lib_deps = https://github.com/netmindz/animartrix.git#bd556cef92a6fee9777c0a7304c9de1a84cba184 ;; init state fix
animartrix_lib_ignore = animartrix ;; to remove the animartrix lib dependancy (saves a few bytes)

DMXin_build_flags = -D WLED_ENABLE_DMX_INPUT  ;; WLEDMM DMX physical input - requires ESP-IDF v4.4.x
DMXin_lib_deps = https://github.com/someweisguy/esp_dmx.git#47db25d8c515e76fabcf5fc5ab0b786f98eeade0  ;; for DMX_INPUT
DMXin_lib_ignore = esp_dmx ;; to remove the esp-dmx lib dependancy (saves a few bytes)

HUB75_build_flags =
  -D WLED_ENABLE_HUB75MATRIX ;; - requires ESP-IDF v4.4.x
   ;-D SPIRAM_FRAMEBUFFER ;; ONLY SUPPORTED ON ESP32-S3 VARIANTS WITH OCTAL (not quad) SPIRAM/PSRAM
  -D NO_GFX ;; Disable the use of Adafruit_GFX by the HUB75 driver
  -D NO_FAST_FUNCTIONS ;; If you are not using AdafruitGFX than you probably do not need this either, save memory/code size
  -D NO_CIE1931 ;; Do not use LED brightness compensation described in CIE 1931. We use FastLED dimming already
  -D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
  -D WLEDMM_SLOWPATH   ;; WLEDMM: do not use I2S for driving ws2812 LEDs (HUB75 driver needs I2S#1)
;; HUB75_lib_deps = https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA.git#aa28e2a9 ;; S3_LCD_DIV_NUM fix
HUB75_lib_deps = https://github.com/softhack007/ESP32-HUB75-MatrixPanel-DMA_sh7.git#fix_dangling_pointer ;; S3 bugfix for crash in ~MatrixPanel_I2S_DMA()
HUB75_lib_ignore = ESP32 HUB75 LED MATRIX PANEL DMA Display ;; to remove the HUB75 lib dependancy (saves a few bytes)

NetDebug_build_flags =
  ;; WLEDMM: only setting WLED_DEBUG_HOST is enough, ip and port can be defined in sync settings as well
  -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible
  -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868


build_flags_S = 
  -Wall -Wformat -Woverflow -Wuninitialized -Winit-self -Warray-bounds ; enables more warnings
  -Wno-attributes -Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations ;disables some stupid warnings
  ;-D WLED_DISABLE_BROWNOUT_DET ; enable if you get "brownout detected" errors at startup 
  -D WLED_USE_MY_CONFIG
  ; -D WLED_DISABLE_2D ;; un-comment to build a firmware without 2D matrix support
  ; -D WLED_USE_CIE_BRIGHTNESS_TABLE ;; experimental: use different color / brightness lookup table
  ${common_mm.AR_build_flags} ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra   
  -D USERMOD_AUTO_PLAYLIST
  ; -D USERMOD_ARTIFX  ;; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2
  -D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  ; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging
  -D WLED_ENABLE_GIF
  ; -D WLED_ENABLE_FULL_FONTS  ;; uncomment for (limited) unicode support in scrolling text - warning: increases firmware size by 6848 bytes

lib_deps_S =
  ;; https://github.com/kosme/arduinoFFT#develop @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash
  ${common_mm.AR_lib_deps}                                           ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3

build_flags_M = 
  -D USERMOD_ARTIFX ; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2
  -D WLED_MAX_USERMODS=25 ; default only 4-6, also for _XL configs takes 25 pointers in memory
  ;; -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4 ewowi to softhack: move to build_flags_S? - We need a different solution
  -D WLED_USE_MY_CONFIG ; include custom my_config.h ewowi to softhack: redundant as also in build_flags_S?
  -D USERMOD_DALLASTEMPERATURE
  -D USE_ALT_DISPLAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
  -D USERMOD_FOUR_LINE_DISPLAY
  -D USERMOD_ROTARY_ENCODER_UI
  -D USERMOD_AUTO_SAVE
  -D WLED_ENABLE_FULL_FONTS  ;; enables (limited) unicode support in scrolling text - warning: increases firmware size by 6848 bytes
  ;;-D WLED_ENABLE_PIXART    ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash

  ${common_mm.animartrix_build_flags}
  ${common_mm.NetDebug_build_flags}

lib_deps_M =
  ;https://github.com/blazoncek/OneWire.git ; includes bugfixes for inconsistent readings
  OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE
  olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY
  ${common_mm.animartrix_lib_deps}

lib_deps_V4_M =
  ;https://github.com/blazoncek/OneWire.git ; includes bugfixes for inconsistent readings
  paulstoffregen/OneWire@ ^2.3.7 ; used for USERMOD_DALLASTEMPERATURE -> need newer release with bugfixes for -S3; still requires TEMPERATURE_PIN < 46
  olikraus/U8g2@ ^2.34.5 ; used for USERMOD_FOUR_LINE_DISPLAY -> need newer version with bugfixes for arduino-esp32 v2.0.4 (Wire initialization) 
  ${common_mm.animartrix_lib_deps}

build_flags_XL = 
  -D WLEDMM_SAVE_FLASH
  -D USERMOD_WEATHER ; WLEDMM usermod
  -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG)
  -D USERMOD_GAMES ; WLEDMM usermod
  -D USERMOD_BATTERY ;; enable Battery usermod
  -D USERMOD_BATTERY_USE_LIPO ;; use new "discharging curve" for LiPo cells
  -D USERMOD_BH1750
  -D USERMOD_ANIMATED_STAIRCASE
  -D USERMOD_RTC ;; experimental
  ; -D USERMOD_SENSORSTOMQTT  ;; experimental ewowi causes error: fatal error: Adafruit_Sensor.h: No such file or directory
  -D USERMOD_ANALOG_CLOCK
  -D USERMOD_MULTI_RELAY
  -D USERMOD_PIRSWITCH
  -D USERMOD_PWM_FAN
  ; -D USERMOD_PING_PONG_CLOCK ;; Removed as dots is confusing
  ; -D USERMOD_BUZZER          ;; Removed as it grabs gpio32 (pin needed by audioreactive) 
  -D USERMOD_SN_PHOTORESISTOR
  -D USERMOD_BME280
  -D USERMOD_DHT
  ; -D USERMOD_SHT ;; experimental
  -D USERMOD_VL53L0X_GESTURES
  -D WLED_ENABLE_PIXART
  ${common_mm.animartrix_build_flags}

lib_deps_XL =
  ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU
  claws/BH1750 @^1.2.0 ; used for USERMOD_BH1750
  ; adafruit/Adafruit BMP280 Library @ 2.1.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT
  ; adafruit/Adafruit CCS811 Library @ 1.0.4 ;; experimental for usermod USERMOD_SENSORSTOMQTT
  ; adafruit/Adafruit Si7021 Library @ 1.4.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT
  BME280@~3.0.0 ; for usermod USERMOD_BME280
  https://github.com/alwynallan/DHT_nonblocking ; for usermod USERMOD_DHT
  ; robtillaart/SHT85 @ ~0.4.0 ;; for usermod USERMOD_SHT
  pololu/VL53L0X @ ^1.3.0 ; for usermod USERMOD_VL53L0X_GESTURES

; end of common

; base entries (without WLED_RELEASE_NAME)

; common defaults for all MM environments
[esp32_4MB_S_base]
extends = esp32_legacy
board = esp32dev
;; legacy V3 platform
platform = ${esp32_legacy.platform}
platform_packages = ${esp32_legacy.platform_packages}
build_unflags = ${esp32_legacy.build_unflags}
build_flags = ${common.build_flags} ${esp32_legacy.build_flags} ${common_mm.build_flags_S} ${common_mm.build_disable_sync_interfaces}
lib_deps = ${esp32_legacy.lib_deps} ${common_mm.lib_deps_S}
lib_ignore = 
  ${common_mm.DMXin_lib_ignore} ;; requires V4 framework
  ${esp32_legacy.lib_ignore}
upload_speed = 460800 ; or 921600
;; new V4 platform
;;platform = ${esp32.platform}
;;platform_packages = ${esp32.platform_packages}
;;build_unflags = ${common.build_unflags}
;;build_flags = ${common.build_flags_esp32} ${common_mm.build_flags_S} ${common_mm.build_disable_sync_interfaces}
;;lib_deps = ${esp32.lib_deps} ${common_mm.lib_deps_S}
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) 
board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o)
monitor_filters = esp32_exception_decoder

;common default for all max environments
[esp32_4MB_M_base]
extends = esp32_4MB_S_base
build_flags =  ${common.build_flags} ${esp32_legacy.build_flags} ${common_mm.build_flags_S} ${common_mm.build_flags_M} ;; we don't want common_mm.build_disable_sync_interfaces, so we cannot inherit from esp32_4MB_S_base
build_unflags = ${esp32_4MB_S_base.build_unflags}
  ${common_mm.animartrix_build_flags}  ;; exceeds flash limits in V3 builds
  -DUSERMOD_ARTIFX                    ;; exceeds flash limits in V3 builds
lib_deps = ${esp32_4MB_S_base.lib_deps} ${common_mm.lib_deps_M}
lib_ignore = ${esp32_4MB_S_base.lib_ignore}
   ${common_mm.animartrix_lib_ignore}
[esp32_4MB_XL_base]
extends = esp32_4MB_M_base
build_flags = ${esp32_4MB_M_base.build_flags} ${common_mm.build_flags_XL}
build_unflags = ${esp32_4MB_M_base.build_unflags}
lib_deps = ${esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL}

;common default for all V4 min environments, including -S3, -S2, -C3
[esp32_4MB_V4_S_base]
board = esp32dev
upload_speed = 460800 ; or 921600
;;platform = ${esp32.platform} ;; "V4" = tasmota = standard
;;platform_packages = ${esp32.platform_packages}
;; softhack007: back to standard espressif platform, due to bad UX when OTA updating a previous versions  - slow, unresponsive, wifi lost, out of RAM
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${common_mm.build_flags_S} ${common_mm.build_disable_sync_interfaces}  ;; do not include ${esp32.build_flagsV4} here !!!!
  -Wno-misleading-indentation -Wno-format-truncation 
  -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
  ;-Wstack-usage=2732       ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes")
  ;-Wsuggest-attribute=const -Wsuggest-attribute=pure ;;  ask compiler for hints on attributes
  ${common_mm.DMXin_build_flags}
lib_deps = ${common_mm.lib_deps_S}                               ;;  do not include ${esp32.lib_depsV4} here !!!!
  ${common_mm.DMXin_lib_deps}
esp32_build_flags = ${esp32.build_flagsV4} ${esp32_4MB_V4_S_base.build_flags} ;; this is for esp32 only, including specific "V4" flags
esp32_lib_deps = ${esp32.lib_depsV4} ${esp32_4MB_V4_S_base.lib_deps}  ;; this is for esp32 only, including specific "V4" flags
;;board_build.partitions = ${esp32.default_partitions}
board_build.partitions = ${esp32.extended_partitions}  ;; 1.65MB firmware, 700KB filesystem
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) 
board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o)
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
monitor_filters = esp32_exception_decoder ; used to show crash details

[esp32_4MB_V4_M_base]
extends = esp32_4MB_V4_S_base
build_flags = 
  ${common.build_flags} ${common_mm.build_flags_S} ;; do not include ${esp32.build_flagsV4} here !!!!
  -Wno-misleading-indentation -Wno-format-truncation 
  -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
  ;-Wstack-usage=2732       ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes")
  ;-Wsuggest-attribute=const -Wsuggest-attribute=pure ;;  ask compiler for hints on attributes
  -D WLED_ENABLE_DMX_INPUT 
  ${common_mm.build_flags_M}               ;; generic, for all variants
lib_deps = ${esp32_4MB_V4_S_base.lib_deps} ${common_mm.lib_deps_V4_M}
esp32_build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ${common_mm.build_flags_M}   ;; for esp32 only, including specific "V4" flags
esp32_lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} ${common_mm.lib_deps_V4_M}
board_build.partitions = ${esp32_4MB_V4_S_base.board_build.partitions} 
;board_build.flash_mode = qio ; (dio = dual i/o; more compatible than qio = quad i/o)

[Shield_ICS4343x]
build_flags = 
  -D SR_DMTYPE=1 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=14  ; for regular I2S microphone
  -D SR_SQUELCH=10 -D SR_GAIN=30 -D SR_FREQ_PROF=5                ; ICS-43434 specific

[Shield_SPM1423]
build_flags = 
  -D SR_DMTYPE=5 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=-1 ; for I2S PDM microphone
  -D SR_SQUELCH=3 -D SR_GAIN=75 -D SR_FREQ_PROF=7                ; SPM1423 specific

[Athom_PDMmic]
build_flags = 
  -D SR_DMTYPE=51 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=-1 ; for I2S PDM microphone Legacy mode!
  -D SR_SQUELCH=10 -D SR_GAIN=40 -D SR_FREQ_PROF=7                ; SPM1423 specific

[Shield_LineIn]
build_unflags = 
  -D BTNPIN=17          ;; remove - its in conflict with on-shield rotary
  -D ENCODER_SW_PIN=5   ;; remove - its in conflict with on-shield rotary
  -D BTNPIN=0           ;; remove - its in conflict with MCLK pin
build_flags = 
  -D BTNPIN=-1
  -D SR_DMTYPE=4 -D MCLK_PIN=0 -D I2S_SDPIN=26 -D I2S_WSPIN=25 -D I2S_CKPIN=27   ; for audio Line-In shield, final version
  -D SR_LINE_DETECT=34                                                           ; line-in plug insert detection sensor (future support)
  -D SR_SQUELCH=8 -D SR_GAIN=40 -D SR_FREQ_PROF=1                                ; CS5343 Line-In specific
  -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=17                ; on-shield rotary encoder

[Debug_Flags]
build_flags = 
  -DDEBUG=1 ;; enable some debug assertions in the platform core
  ; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging
  -D WLED_DEBUG ; lots of generic debug messages
  -D SR_DEBUG ; some extra debug messages from audioreactive
  ; -D MIC_LOGGER ; for sound input monitoring & debugging (use arduino serial plotter)
  ; NetDebug moved to build_flags_M

[Speed_Flags]
build_flags =
  -O2 ;; optimize for performance instead of size
  ;-ffast-math ;; gives a few  (2-5) percent speedup on ESP32-S3, but causes slight slowdown on classic ESP32
  -funsafe-math-optimizations ;; less dangerous than -ffast-math; still allows the compiler to exploit FMA and reciprocals  (10% faster on -S3)
  ;; -mtarget-align ;; this one is included in -O2, so its not necessary to explicitly add it
  -free -fipa-pta ;; these are very useful, too
  -fno-jump-tables -fno-tree-switch-conversion                 ;; needed
  -freorder-blocks -Wwrite-strings -fstrict-volatile-bitfields ;; needed
build_flags_V4 = ${Speed_Flags.build_flags} -fsingle-precision-constant ;; old framework does not like this flag
build_unflags =
  -Os ;; to disable standard optimization for size

; end of base entries


; bin entries (with WLED_RELEASE_NAME)
;; ESP32, 4MB, optimized for speed, basic features and audioreactive only
[env:esp32_4MB_S]
extends = esp32_4MB_S_base
build_unflags = ${esp32_4MB_S_base.build_unflags}
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${esp32_4MB_S_base.build_flags}
  ${Speed_Flags.build_flags}  ;; -O2 -> optimize for speed instead of size
  -D WLED_RELEASE_NAME=esp32_4MB_S
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  ;-D WLEDMM_SAVE_FLASH
  ;WLEDMM: disable the next line if you don't need "net Debug". It will free ~2% of flash
  ${common_mm.NetDebug_build_flags}
;; optimized-for-speed build
; RAM:   [==        ]  23.6% (used 77188 bytes from 327680 bytes)
; Flash: [========= ]  93.8% (used 1475997 bytes from 1572864 bytes)

[env:esp32_4MB_M]
extends = esp32_4MB_M_base
build_flags = ${esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_M
  -D WLEDMM_SAVE_FLASH
; RAM:   [==        ]  24.2% (used 79196 bytes from 327680 bytes)
; Flash: [==========]  97.4% (used 1532425 bytes from 1572864 bytes)

[env:esp32_4MB_M_eth]
extends = esp32_4MB_M_base
;;board_build.partitions = ${esp32.default_partitions}
board_build.partitions = ${esp32.extended_partitions}  ;; 1.65MB firmware, 700KB filesystem
build_flags = ${esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_M_eth
  -D WLED_USE_ETHERNET
  -D RLYPIN=-1 -D BTNPIN=-1 -D IRPIN=-1 ;; Prevent clash
  -D LEDPIN=4 ;; safe default
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D WLEDMM_SAVE_FLASH
  ;-D WLED_DISABLE_ALEXA
  ;-D WLED_DISABLE_HUESYNC ;; Over the limits ?
  ;-D WLED_DISABLE_LOXONE  ;; Over the limits
  ;-D WLED_DISABLE_MQTT
  -D WLED_DISABLE_INFRARED ;; Over the limit
  -D WLED_DISABLE_PARTICLESYSTEM1D  ;; exceeds flash size limit
  -D WLED_DISABLE_PARTICLESYSTEM2D  ;; exceeds flash size limit
; RAM:   [==        ]  24.1% (used 78904 bytes from 327680 bytes)
; Flash: [==========]  98.5% (used 1548489 bytes from 1572864 bytes

[env:esp32_4MB_XL]
extends = esp32_4MB_XL_base
build_flags = ${esp32_4MB_XL_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_XL
  ;-D WLED_DISABLE_ALEXA
  ;-D WLED_DISABLE_HUESYNC ;; Over the limits ?
  -D WLED_DISABLE_LOXONE  ;; Over the limits
  ;-D WLED_DISABLE_MQTT
  ;-D WLED_DISABLE_INFRARED
  -D WLEDMM_SAVE_FLASH    ;; a humble attempt to save a few extra bytes
build_unflags = ${esp32_4MB_XL_base.build_unflags}
board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv
; RAM:   [==        ]  24.5% (used 80140 bytes from 327680 bytes)
; Flash: [========= ]  85.8% (used 1630789 bytes from 1900544 bytes)

;; standard framework build for 16MB flash, optimized for speed
[env:esp32_16MB_S]
extends = esp32_4MB_S_base
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
build_unflags = ${esp32_4MB_S_base.build_unflags}
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${esp32_4MB_S_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_S
  ${Speed_Flags.build_flags}  ;; optimize for speed instead of size
  -D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_GIF         ;; 28KB Flash
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32_4MB_S_base.lib_deps}
  ${common_mm.animartrix_lib_deps}
; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
;; optimized-for-speed build
; RAM:   [==        ]  23.7% (used 77524 bytes from 327680 bytes)
; Flash: [=======   ]  72.9% (used 1528541 bytes from 2097152 bytes)

[env:esp32_16MB_M]
extends = esp32_4MB_M_base
build_flags = ${esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_M
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [==        ]  24.2% (used 79196 bytes from 327680 bytes)
; Flash: [=======   ]  73.6% (used 1542905 bytes from 2097152 bytes)

[env:esp32_4MB_M_debug]
extends = esp32_4MB_M_base
build_unflags = ${common.build_unflags} 
  -D CORE_DEBUG_LEVEL=0
  -D USERMOD_ANIMARTRIX ;; Tips our memory usage over the limit

build_flags = ${esp32_4MB_M_base.build_flags} 
  ${Debug_Flags.build_flags}
  -D CORE_DEBUG_LEVEL=2   ;; 2=warning
  -D WLED_RELEASE_NAME=esp32_4MB_M_debug
monitor_filters = esp32_exception_decoder
; RAM:   [==        ]  24.1% (used 79060 bytes from 327680 bytes)
; Flash: [==========]  99.3% (used 1561969 bytes from 1572864 bytes)

[env:esp32_16MB_M_debug]
extends = esp32_4MB_M_base
build_unflags = ${common.build_unflags} 
  -D CORE_DEBUG_LEVEL=0
  -D NDEBUG
build_flags = ${esp32_4MB_M_base.build_flags} 
  ${Debug_Flags.build_flags}
  ; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging (needs newer framework versions)
  -D CORE_DEBUG_LEVEL=2   ;; 2=warning
  -D WLED_RELEASE_NAME=esp32_16MB_M_debug
monitor_filters = esp32_exception_decoder
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
; RAM:   [==        ]  24.3% (used 79468 bytes from 327680 bytes)
; Flash: [========  ]  76.7% (used 1609205 bytes from 2097152 bytes)

[env:esp32_16MB_XL]
extends = esp32_4MB_XL_base
build_flags = ${esp32_4MB_XL_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_XL
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [==        ]  24.5% (used 80140 bytes from 327680 bytes)
; Flash: [========  ]  77.8% (used 1631929 bytes from 2097152 bytes)

[env:esp32_16MB_M_eth]
extends = esp32_4MB_M_base
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
board = esp32_16MB-poe       ;; needed for ethernet boards (selects "esp32-poe" as variant)
build_flags = ${esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_M_eth ; This will be included in the firmware.bin filename
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLED_USE_ETHERNET
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 
  -D LEDPIN=4
; RAM:   [==        ]  24.2% (used 79388 bytes from 327680 bytes)
; Flash: [=======   ]  73.8% (used 1548525 bytes from 2097152 bytes)


[env:esp8266_2MB_S]
extends = env:esp8266_2m
upload_speed = 460800 ;115200
board_build.f_cpu = 160000000L    ;; we want 160Mhz (default = 80Mhz)
build_flags = ${common.build_flags_esp8266}
  -D WLED_RELEASE_NAME=esp8266_2MB_S
  -D WLED_USE_UNREAL_MATH ;; may cause some wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  -D WLED_DISABLE_LOXONE ;  FLASH 1272 bytes
  -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_MQTT ;    RAM 216 bytes; FLASH 16496 bytes
  ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  ; -D WLED_DISABLE_2D
  ; -UWLED_USE_MY_CONFIG
  ${common_mm.NetDebug_build_flags}
  ; -D WLED_DEBUG
; monitor_filters = esp8266_exception_decoder
;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [======    ]  61.3% (used 50224 bytes from 81920 bytes)
; Flash: [========= ]  87.6% (used 915303 bytes from 1044464 bytes)

[env:esp8266_4MB_S]
extends = env:d1_mini
upload_speed = 460800 ;115200
board_build.f_cpu = 160000000L    ;; we want 160Mhz (default = 80Mhz)
build_flags = ${common.build_flags_esp8266}
  -D WLED_RELEASE_NAME=esp8266_4MB_S
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  -D WLED_DISABLE_LOXONE ;  FLASH 1272 bytes
  ;; -D WLED_DISABLE_MQTT ;    RAM 216 bytes; FLASH 16496 bytes
  ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  ; -D WLED_DISABLE_2D
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D
  -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  -D WLEDMM_SAVE_FLASH
  -D WLED_USE_UNREAL_MATH
  ; -UWLED_USE_MY_CONFIG
  ${common_mm.NetDebug_build_flags}
  ; -D WLED_DEBUG
; monitor_filters = esp8266_exception_decoder
;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [======    ]  61.3% (used 50220 bytes from 81920 bytes)
; Flash: [========= ]  89.5% (used 934483 bytes from 1044464 bytes)
[env:esp8266_4MB_M]
extends = env:d1_mini
upload_speed = 460800 ;115200
board_build.f_cpu = 160000000L    ;; we want 160Mhz (default = 80Mhz)
build_flags = ${common.build_flags_esp8266}
  -D WLED_RELEASE_NAME=esp8266_4MB_M
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_LOXONE
  -D WLEDMM_SAVE_FLASH
  -D WLED_USE_UNREAL_MATH
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  ; -D USERMOD_AUDIOREACTIVE
  ; -UWLED_USE_MY_CONFIG
  ; -D USERMOD_PIRSWITCH
  ; -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  ; -D USERMOD_MULTI_RELAY
  -D USE_ALT_DISPLAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
  -D WLED_MAX_USERMODS=5 ; default only 4 on ESP8266
  -D USERMOD_FOUR_LINE_DISPLAY
  -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG)
  -D USERMOD_GAMES ; WLEDMM usermod
  ; -D USERMOD_ARTIFX ; this is compiling but not working due to low memory on 8266
  -D USERMOD_BATTERY ;; enable Battery usermod
  -D USERMOD_BATTERY_USE_LIPO ;; use new "discharging curve" for LiPo cells
  ${common_mm.NetDebug_build_flags}
  ; -D WLED_DEBUG
monitor_filters = esp8266_exception_decoder
lib_deps = ${esp8266.lib_deps}
  OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE
  olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY 
  ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU
lib_ignore = ${esp8266.lib_ignore}
; RAM:   [======    ]  63.0% (used 51608 bytes from 81920 bytes)
; Flash: [========= ]  94.9% (used 991039 bytes from 1044464 bytes)

; Blaz env (for reference purposes)
[env:d1_mini_temp]
extends = env:d1_mini
board_build.filesystem = littlefs
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP_8266
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_LOXONE
  -D WLED_ENABLE_SIMPLE_UI
  -D USERMOD_FOUR_LINE_DISPLAY
  -D USE_ALT_DISPlAY
  -D USERMOD_DALLASTEMPERATURE
  -D TEMPERATURE_PIN=13 # (D7)
  -D LEDPIN=2     # (D4)
  -D RLYPIN=12    # (D6)
  -D BTNPIN=0     # (D3)
  -D IRPIN=14     # (D5)
  -D USERMOD_MULTI_RELAY
  -D MULTI_RELAY_MAX_RELAYS=2
  -D USERMOD_PIRSWITCH
  -D PIR_SENSOR_PIN=16
  -D PIR_SENSOR_OFF_SEC=60
  -UWLED_USE_MY_CONFIG
lib_deps = ${esp8266.lib_deps}
  paulstoffregen/OneWire@~2.3.7 ;WLEDMM Softhack, we need this as well (instead of 2.3.5)?
  olikraus/U8g2 # @~2.33.15
  Wire ; WLEDMM ewowi, needed?
lib_ignore = ${esp8266.lib_ignore}

[env:esp8266pro_16MB_S]
extends = env:d1_mini
board = d1_mini_pro ;; "D1 mini pro": ESP8266EX, 160MHz, 80KB RAM, 16MB Flash
board_build.f_cpu = 160000000L    ;; we want 160Mhz (default = 80Mhz)
;board_build.f_flash = 80000000L  ;; for 80Mhz flash speed, in case your chip can handle it (default = 40Mhz)
board_build.flash_mode = qio      ;; quad IO - fastest speed, in case your chip can handle it.
;;board_build.flash_mode = dout   ;; use if your esp8266 becomes unstable with "qio"
board_build.ldscript = ${common.ldscript_16m14m} ;; 16MB flash, use 14MB for LittleFS

upload_speed = 460800 ;115200
build_flags = ${common.build_flags_esp8266}
  -D WLED_RELEASE_NAME=esp8266pro_16MB_S
  -D WLED_WATCHDOG_TIMEOUT=0
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  ; -D WLED_DEBUG ${common.debug_flags} ;; un-comment for debug messages
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  -D WLEDMM_SAVE_FLASH
  ;; -D WLED_USE_UNREAL_MATH
  ${common_mm.NetDebug_build_flags}
  ;; -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  ; -D WLED_DISABLE_LOXONE ;  FLASH 1272 bytes
  ; -D WLED_DISABLE_MQTT ;    RAM 216 bytes; FLASH 16496 bytes
  ; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ewowi: disabled to stay below 100%
  ; -D WLED_DISABLE_2D
  ; -D USERMOD_AUDIOREACTIVE
  ; -D USERMOD_ARTIFX ; to be done
  ; -UWLED_USE_MY_CONFIG
monitor_filters = esp8266_exception_decoder
; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [======    ]  61.5% (used 50400 bytes from 81920 bytes)
; Flash: [========= ]  90.1% (used 941059 bytes from 1044464 bytes)

[env:esp8266pro_16MB_M]
extends = env:d1_mini
board = d1_mini_pro ;; "D1 mini pro": ESP8266EX, 160MHz, 80KB RAM, 16MB Flash
board_build.f_cpu = 160000000L    ;; we want 160Mhz (default = 80Mhz)
;board_build.f_flash = 80000000L  ;; for 80Mhz flash speed, in case your chip can handle it (default = 40Mhz)
board_build.flash_mode = qio      ;; quad IO - fastest speed, in case your chip can handle it.
;;board_build.flash_mode = dout   ;; use if your esp8266 becomes unstable with "qio"
board_build.ldscript = ${common.ldscript_16m14m} ;; 16MB flash, use 14MB for LittleFS

upload_speed = 460800 ;115200
build_flags = ${common.build_flags_esp8266}
  -D WLED_RELEASE_NAME=esp8266pro_16MB_M
  -D WLED_MAX_USERMODS=5 ; default only 4-6
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_LOXONE
  ; -D USERMOD_AUDIOREACTIVE
  ; -D USERMOD_ARTIFX ; to be done
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D
  -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  -D WLEDMM_SAVE_FLASH
  ;; -D WLED_USE_UNREAL_MATH
  -D USERMOD_PIRSWITCH
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  -D USERMOD_MULTI_RELAY
  -D USE_ALT_DISPLAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
  -D USERMOD_FOUR_LINE_DISPLAY
  -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG)
  -D USERMOD_GAMES ; WLEDMM usermod
  ${common_mm.NetDebug_build_flags}
  ; -D WLED_DEBUG
monitor_filters = esp8266_exception_decoder
lib_deps = ${esp8266.lib_deps}
  OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE
  olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY 
  ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU
lib_ignore = ${esp8266.lib_ignore}
; RAM:   [======    ]  62.9% (used 51508 bytes from 81920 bytes)
; Flash: [==========]  96.2% (used 1005115 bytes from 1044464 bytes)

[env:esp01_1MB_S]
board = esp01_1m
platform = ${common.platform_wled_default}
platform_packages = ${common.platform_packages}
board_build.ldscript = ${common.ldscript_1m128k}
build_unflags = ${esp8266.build_unflags}
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
  -D WLED_RELEASE_NAME=esp01_1MB_S
  -D WLED_USE_UNREAL_MATH ;; may cause some wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_ESPNOW   ;; exceeds flash size limits
  -D WLED_DISABLE_INFRARED ;; exceeds flash size limits
  -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  -D WLEDMM_SAVE_FLASH
  ;; -D WLED_DISABLE_LOXONE
  ;; -D WLED_DISABLE_MQTT
  ;; -D WLED_DISABLE_2D ;; last resort to reduce flash size
lib_deps = ${esp8266.lib_deps}
lib_ignore = ${esp8266.lib_ignore}
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [======    ]  60.3% (used 49408 bytes from 81920 bytes)
; Flash: [==========]  98.6% (used 880331 bytes from 892912 bytes)


# ------------------------------------------------------------------------------
# MoonModules environments for IDF V4.4.x
# ------------------------------------------------------------------------------
;; Warning: the build-in LittleFS (arduino-esp32 2.0.x) seems to be "slightly different" from Lorol LittleFS. 
;; When upgrading to the new framework, it might be necessary to first do a chip erase (make sure you have a backup of cfg.json and presets.json)

; compiled with ESP-IDF 4.4.1; HUB75 supported, OTA compatible with upstream
[env:esp32_4MB_V4_S_HUB75]
extends = esp32_4MB_V4_S_base
board_build.partitions = ${esp32.default_partitions} ;; compatible with upstream
build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  ${common_mm.DMXin_build_flags} ;; exceeds flash size limits
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_V4_S_HUB75
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_INFRARED
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  -D WLED_ENABLE_PIXELFORGE
  -D WLEDMM_SAVE_FLASH
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
    ${common_mm.DMXin_lib_ignore}
; RAM:   [===       ]  25.5% (used 83396 bytes from 327680 bytes)
; Flash: [==========]  98.2% (used 1543949 bytes from 1572864 bytes)

[env:esp32_4MB_V4_S] ;; legacy alias
extends = env:esp32_4MB_V4_S_HUB75

; standard MM build for classic esp32; HUB75 not included
[env:esp32_4MB_V4_M]
extends = esp32_4MB_V4_M_base
;; needs tasmota framework; will exceed flash limits with default framework
platform = ${esp32.platform} ;; "V4" tasmota
platform_packages = ${esp32.platform_packages}
build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_V4_M
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLED_ENABLE_PIXELFORGE
  ;;-D WLEDMM_SAVE_FLASH
  ;;-D WLED_DISABLE_PARTICLESYSTEM1D ;; may exceed flash size limit
  ;;-D WLED_DISABLE_PARTICLESYSTEM2D ;; may exceed flash size limit
lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps}
lib_ignore = 
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ${common_mm.HUB75_lib_ignore}  ;; over the flash size limit
  ;;${common_mm.animartrix_lib_ignore}
build_unflags = ${esp32_4MB_V4_M_base.build_unflags}
  ${common_mm.HUB75_build_flags}  ;; over the flash size limit
  ;;-D USERMOD_ANIMARTRIX ;; Tips our memory usage over the limit
  ;; -D USERMOD_ARTIFX
  ;; -D USERMOD_AUTO_SAVE
  ;; -D WLED_ENABLE_HUB75MATRIX
  -D WLED_DISABLE_ADALIGHT
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH  6308 bytes
  -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  ;;-D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
; RAM:   [==        ]  24.3% (used 79660 bytes from 327680 bytes)
; Flash: [========= ]  87.7% (used 1494213 bytes from 1703936 bytes)

[env:esp32_4MB_V4_S_eth]
extends = esp32_4MB_V4_S_base
;;board_build.partitions = ${esp32.default_partitions}
board_build.partitions = ${esp32.extended_partitions}  ;; 1.65MB firmware, 700KB filesystem
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=esp32_4MB_V4_S_eth
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_INFRARED
  -D WLED_ENABLE_PIXELFORGE
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  -D WLED_USE_ETHERNET
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 
  -D LEDPIN=4
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; RAM:   [===       ]  25.6% (used 84048 bytes from 327680 bytes)
; Flash: [==========]  96.1% (used 1637085 bytes from 1703936 bytes)

[env:esp32_16MB_V4_M_eth]
extends = esp32_4MB_V4_M_base
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
board = esp32_16MB-poe       ;; needed for ethernet boards (selects "esp32-poe" as variant)
build_unflags = ${esp32_4MB_V4_M_base.build_unflags}
  ${Speed_Flags.build_unflags}  ;; to override -Os
  -D WLED_DISABLE_ADALIGHT
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH  6308 bytes
  -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  ;;-D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_V4_M_eth ; This will be included in the firmware.bin filename
  ${Speed_Flags.build_flags_V4}  ;; -O2 -> optimize for speed instead of size
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ;; ${common_mm.HUB75_build_flags} ;; not enough pins for HUB75
  ;; -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  -D WLED_USE_ETHERNET
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 
  -D LEDPIN=4
lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps}
    ;; ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
; RAM:   [===       ]  26.7% (used 87368 bytes from 327680 bytes)
; Flash: [=======   ]  65.5% (used 2061117 bytes from 3145728 bytes)

;; softhack007: my favourite HUB75 buildenv - fastest possible
[env:esp32_4MB_V4_HUB75_forum]
extends = esp32_4MB_V4_S_base
platform_packages = ${esp32_4MB_V4_S_base.platform_packages}
;;  toolchain-xtensa-esp32@~11.2 ;; for trying out newer gcc @11.2.0+2022r1       ;; 25fps -> 30fps;;  FastLED 3.7.1 required !!

build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  ${Speed_Flags.build_unflags}  ;; to override -Os
  ;; -D WLED_ENABLE_DMX_INPUT
  -DARDUINO_EVENT_RUNNING_CORE=1
  ;;-DCORE_DEBUG_LEVEL=0
  ;; -D NDEBUG
  ;; -D NO_CIE1931 ;; Do use LED brightness compensation described in CIE 1931

build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  ;; -Wsuggest-attribute=const -Wsuggest-attribute=pure
  ;; -Wmissing-noreturn -Wmissing-return
  ;; -Wall -Wextra 
  -Wno-unused-value -Wno-format -Wno-type-limits
  -D WLED_RELEASE_NAME=esp32_4MB_V4_HUB75_forum
  ${Speed_Flags.build_flags_V4}  ;; -O2 -> optimize for speed instead of size
  ;; -D DEBUG
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_HUESYNC
  -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_INFRARED
  -D WLED_DISABLE_ADALIGHT
  -D WLED_ENABLE_FULL_FONTS  ;; increases firmware size by 6848 bytes
  -D WLED_ENABLE_PIXELFORGE
  ;; -D WLED_DEBUG
  ;; -D SR_DEBUG
  -D WLED_BOOTUPDELAY=350
  ${common_mm.HUB75_build_flags}
  -DESP32_FORUM_PINOUT
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  ${common_mm.animartrix_build_flags}
  -DARDUINO_EVENT_RUNNING_CORE=0  ;; assign Wifi to core0, to have more CPU on core#1 (arduino loop)
  ;;-DARDUINO_RUNNING_CORE=1        ;; should be default, but does not hurt
  -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - seems to move more buffers into PSRAM
  ;; -D CONFIG_ESP32_REV_MIN=3  ;;  disables PSRAM bug workarounds in the core, reducing the code size and improving overall performance.
  -D JSON_BUFFER_SIZE=18432 -D MIN_HEAP_SIZE=6144
  -D MAX_SEGMENT_DATA=40960  ;; default 32767
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_BROWNOUT_DET
  ;;-DCORE_DEBUG_LEVEL=1
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ;; ${common_mm.DMXin_lib_ignore}

board_build.partitions = ${esp32.big_partitions}
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) 
board_build.flash_mode = qio ; (dio = dual i/o; more compatible than qio = quad i/o)
; RAM:   [==        ]  23.9% (used 78400 bytes from 327680 bytes)
; Flash: [==========]  98.1% (used 1863653 bytes from 1900544 bytes)

;; V4 build for 16MB flash, optimized for speed; HUB75 supported
[env:esp32_16MB_V4_S]
extends = esp32_4MB_V4_S_base
build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  ${Speed_Flags.build_flags_V4}  ;; optimize for speed instead of size
  -D WLED_RELEASE_NAME=esp32_16MB_V4_S
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLED_DISABLE_BROWNOUT_DET
  -D JSON_BUFFER_SIZE=18432 -D MIN_HEAP_SIZE=6144
  -D MAX_SEGMENT_DATA=40960  ;; default 32767
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_GIF         ;; 28KB Flash
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
;; optimized-for-speed build
; RAM:   [==        ]  23.7% (used 77704 bytes from 327680 bytes)
; Flash: [========  ]  84.4% (used 1770341 bytes from 2097152 bytes)

; compiled with ESP-IDF 4.4.1; HUB75 included (may have PIN conflicts)
[env:esp32_16MB_V4_M]
extends = esp32_4MB_V4_M_base
build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=esp32_16MB_V4_M
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  ;; -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
  -D WLED_ENABLE_DMX_INPUT ;; needs more testing
  -D LEDPIN=16 -D RLYPIN=19
  -D AUDIOPIN=-1 -D TEMPERATURE_PIN=23 -D PIR_SENSOR_PIN=-1 -D PWM_PIN=-1
  -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=5  ; WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  -D HW_PIN_SCL=22 -D HW_PIN_SDA=21
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_GIF         ;; 28KB Flash
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
; RAM:   [===       ]  25.7% (used 84104 bytes from 327680 bytes)
; Flash: [========  ]  80.7% (used 1692269 bytes from 2097152 bytes)

[env:esp32_16MB_V4_M_debug]
extends = esp32_4MB_V4_M_base
build_unflags = ${common.build_unflags}
  -D CORE_DEBUG_LEVEL=0
  -D NDEBUG
build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags}
  ${Debug_Flags.build_flags}
  -D CORE_DEBUG_LEVEL=4  ;; 0=none, 1=error, 2=warning, 3=info, 4=debug, 5=verbose
  -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging
  -D WLED_RELEASE_NAME=esp32_16MB_V4_M_debug
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps}
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
monitor_filters = esp32_exception_decoder
; RAM:   [===       ]  26.4% (used 86356 bytes from 327680 bytes)
; Flash: [========  ]  83.6% (used 1753461 bytes from 2097152 bytes)

;; experimental environment for boards with PSRAM (needs ESP-IDF 4.4.1). HUB75 included (may have PIN conflicts)
[env:esp32_4MB_PSRAM_S]
extends = esp32_4MB_V4_S_base
board = lolin_d32_pro
;board = esp32cam
;board = ttgo-t7-v14-mini32
board_build.f_flash = 80000000L
;;board_build.flash_mode = qio
board_build.flash_mode = dio
board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB filesystem

build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  -D WLED_ENABLE_DMX
  -D WLED_ENABLE_DMX_INPUT
  ; -D WLED_ENABLE_HUB75MATRIX ;; uses a lot of flash  
  ; -D USERMOD_ANIMARTRIX ;; uses a lot of memory
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} 
  -D WLED_RELEASE_NAME=esp32_4MB_PSRAM_S
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLEDMM_SAVE_FLASH
  -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
  -D LEDPIN=25 -D DATA_PINS=25 ; avoid pin 16 = PSRAM
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM ;; WLED_USE_PSRAM causes major slow-down (slow LEDs) on some ESP32 boards
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -D WLED_DISABLE_LOXONE ;  FLASH 1272 bytes
  -D WLED_DISABLE_HUESYNC ; RAM 122 bytes; FLASH  6308 bytes
  -D WLED_DISABLE_ALEXA ;   RAM 116 bytes; FLASH 13524 bytes
  -D WLED_DISABLE_MQTT ;    RAM 216 bytes; FLASH 16496 bytes
  -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ewowi: disabled to stay below 100%
  -D WLED_ENABLE_PIXELFORGE
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
lib_ignore =
    IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
    ;; ${common_mm.HUB75_lib_ignore}
    ${common_mm.animartrix_lib_ignore}
    ${common_mm.DMXin_lib_ignore}
;; RAM:   [==        ]  18.0% (used 58916 bytes from 327680 bytes)
;; Flash: [========= ]  94.2% (used 1605257 bytes from 1703936 bytes)

;; similar to 4MB_PSRAM_S, but optimized for WROVER-E (chip revision >= 3) that doesn't need any workarounds for PSRAM any more
;; tl;dr: its faster on PSRAM. But it will not work on all boards.
[env:esp32_4MB_PSRAM_REV3_S]
extends = esp32_4MB_V4_S_base
;board = esp32cam
board = lolin_d32_pro
;board = ttgo-t7-v14-mini32
board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB filesystem
board_build.f_flash = 80000000L
board_build.flash_mode = qio

build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  ;;${Speed_Flags.build_unflags}  ;; to override -Os
  -DARDUINO_EVENT_RUNNING_CORE=1  ;; we want to run wifi on core0, so remove the standard flag
  -mfix-esp32-psram-cache-issue    ;; this fix is not needed any more for revision 3
  -mfix-esp32-psram-cache-strategy=memw ;; same as above

build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  -DARDUINO_EVENT_RUNNING_CORE=0  ;; assign Wifi to core0, to have more CPU on core#1 (arduino loop)
  -DARDUINO_RUNNING_CORE=1        ;; should be default, but does not hurt
  -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - seems to move more buffers into PSRAM
  ;;${Speed_Flags.build_flags_V4}  ;; optimize for speed instead of size --> over 100% flash, but works with 256KB filesystem (alternative partitions file)
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLEDMM_SAVE_FLASH
  -DBOARD_HAS_PSRAM  ;; -D WLED_USE_PSRAM ;; WLED_USE_PSRAM causes major slow-down (slow LEDs) on some ESP32 boards
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  ;;-D CONFIG_ESP32_REV_MIN=3  ;;  disables PSRAM bug workarounds in the core, reducing the code size and improving overall performance.
  -D WLED_RELEASE_NAME=esp32_4MB_PSRAM_REV3_S
  -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D LEDPIN=25 -D DATA_PINS=25 ; avoid pin 16 = PSRAM
  -D WLED_DISABLE_LOXONE ;  FLASH 1272 bytes
  -D WLED_DISABLE_HUESYNC ; RAM 122 bytes; FLASH  6308 bytes
  -D WLED_DISABLE_ALEXA ;   RAM 116 bytes; FLASH 13524 bytes
  ; -D WLED_DISABLE_MQTT ;    RAM 216 bytes; FLASH 16496 bytes
  -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ewowi: disabled to stay below 100%
  ;-D WLED_DISABLE_ADALIGHT  ;; To disable serial protocols (see upstream #3128)
  ; -D WLED_ENABLE_DMX
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
  ${common_mm.HUB75_build_flags}
  -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - set AR default mode to 'Network Receive Only' to prevent driver conflicts.
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
    ${common_mm.HUB75_lib_deps}
lib_ignore =
    IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
    ${common_mm.animartrix_lib_ignore}
    ;; ${common_mm.HUB75_lib_ignore}
;; RAM:   [==        ]  18.2% (used 59608 bytes from 327680 bytes)
;; Flash: [========= ]  94.5% (used 1610657 bytes from 1703936 bytes)


# ------------------------------------------------------------------------------
# esp32-S3 environments
# ------------------------------------------------------------------------------


[env:esp32S3_4MB_S] ;; Use for HD-WF2
extends = esp32_4MB_V4_M_base
;; use standard espressif platform - tasmota platform seems to have problems when there is no PSRAM (sdkconfig.h file not found)
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
board = esp32-s3-devkitc-1
build_unflags = 
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  -D USE_ALT_DISPLAY ;; four line display seems to have problems with I2C - it hangs during usermod setup
  -D USERMOD_FOUR_LINE_DISPLAY ;; see above
  -D USERMOD_ROTARY_ENCODER_UI ;; see above
  -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)

build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} 
  ${common_mm.HUB75_build_flags}
  ${common_mm.animartrix_build_flags}
  -D WLED_RELEASE_NAME=esp32S3_4MB_S 
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0   ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  -D WLED_DISABLE_ADALIGHT     ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ${common_mm.build_disable_sync_interfaces}
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLEDMM_SAVE_FLASH
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
board_build.f_flash = 80000000L
board_build.flash_mode = dio
board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB filesystem


[env:esp32S3_8MB_M]
extends = esp32_4MB_V4_M_base
;; use standard espressif platform - tasmota platform seems to have problems when there is no PSRAM (sdkconfig.h file not found)
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
board = esp32-s3-devkitc-1
build_unflags = 
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  -D USE_ALT_DISPLAY ;; four line display seems to have problems with I2C - it hangs during usermod setup
  -D USERMOD_FOUR_LINE_DISPLAY ;; see above
  -D USERMOD_ROTARY_ENCODER_UI ;; see above
  -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)

build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  ${common_mm.HUB75_build_flags}
  ${common_mm.animartrix_build_flags}
  ; -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON -D WLED_USE_PSRAM ;; un-comment in case your board supports PSRAM
  ;; -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -D WLED_RELEASE_NAME=esp32S3_8MB_M 
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0   ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  ;;-D WLED_DISABLE_ADALIGHT     ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ; -D U8X8_HAVE_2ND_HW_I2C ;; experimental - tells U8g2 lib that a second HW I2C unit exists
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  ; -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  ; -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes
  ; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ;;-D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D LEDPIN=4
  ;-D STATUSLED=39
  -D BTNPIN=48
  -D RLYPIN=21
  -D IRPIN=15
  -D HW_PIN_SDA=42 ;; ESP32-S3 default: SDA = 8
  -D HW_PIN_SCL=41 ;; ESP32-S3 default: SCL = 9
  -D AUDIOPIN=-1
  -D SR_DMTYPE=1 -D I2S_SDPIN=16 -D I2S_CKPIN=17 -D I2S_WSPIN=47 -D MCLK_PIN=40
  -D ES7243_SDAPIN=8 -D ES7243_SCLPIN=18
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
     ${common_mm.HUB75_lib_deps}
     ${common_mm.animartrix_lib_deps}

;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
board_build.partitions = tools/WLED_ESP32_8MB.csv
board_build.flash_mode = qio
; RAM:   [===       ]  25.4% (used 83320 bytes from 327680 bytes)
; Flash: [=======   ]  70.6% (used 1479573 bytes from 2097152 bytes)

;; MM for ESP32-S3 PSRAM development board, with 8MB FLASH and >= 8MB PSRAM (memory_type: qio_opi)
;; HUB75 supported, but may still hve pin conflicts
[env:esp32S3_8MB_PSRAM_M]
extends = esp32_4MB_V4_M_base
;; we have enough flash - use standard espressif platform instead of tasmota
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}

board = esp32-s3-devkitc-1 ;; generic S3 dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_opi     ;; use with PSRAM: 8MB or 16MB
;; board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or  4MB
board_build.flash_mode = qio ;; use "dio" if your board gets unstable with "qio"; also change then previous lines accordingly (memory_type)

build_unflags = ${env:esp32S3_8MB_M.build_unflags}   ;; use the same as "normal" S3 buildenv
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  ${common_mm.HUB75_build_flags}
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM ;; your board supports PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -D WLED_RELEASE_NAME=esp32S3_8MB_PSRAM_M
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0     ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1   ;; for Hardware-CDC USB mode
  ;;-D WLED_DISABLE_ADALIGHT     ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ;;-D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  ; -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  ; -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes
  ; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D LEDPIN=21
  ;;-D DATA_PINS=21,48,3 -D PIXEL_COUNTS=30,1,144  ;; just an example: my board has a builtin neopixel on gpio48
  ; -D STATUSLED=2
  -D BTNPIN=0 -D RLYPIN=1 -D IRPIN=-1
  -D HW_PIN_SDA=42 -D HW_PIN_SCL=41
  -D AUDIOPIN=-1
  -D SR_DMTYPE=1 -D I2S_SDPIN=14 -D I2S_CKPIN=45 -D I2S_WSPIN=47 -D MCLK_PIN=46
  ;;-D ES7243_SDAPIN=8 -D ES7243_SCLPIN=18
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
     ${common_mm.HUB75_lib_deps}
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
monitor_filters = esp32_exception_decoder
board_build.partitions = tools/WLED_ESP32_8MB.csv
; RAM:   [==        ]  21.1% (used 69156 bytes from 327680 bytes)
; Flash: [========  ]  75.9% (used 1591817 bytes from 2097152 bytes)

[env:esp32S3_8MB_S]
;; MM for ESP32-S3 boards - FASTPATH + optimize for speed; ; HUB75 support included (may still have pin conflicts)
extends = esp32_4MB_V4_M_base
;; use standard espressif platform - tasmota platform seems to have problems when there is no PSRAM (sdkconfig.h file not found)
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
board = esp32-s3-devkitc-1 ;; generic S3 dev board
board_build.flash_mode = qio ;; use "dio" if your board gets unstable with "qio"
build_unflags = ${env:esp32S3_8MB_M.build_unflags}   ;; use the same as "normal" S3 buildenv
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S}
  -D WLED_RELEASE_NAME=esp32S3_8MB_S
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0   ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  ;;-D WLED_DISABLE_ADALIGHT     ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  ${Speed_Flags.build_flags_V4}  ;; optimize for speed instead of size
  -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  ${common_mm.HUB75_build_flags}
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_GIF         ;; 28KB Flash
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes
  -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  -D LEDPIN=4
  ;-D STATUSLED=39
  -D BTNPIN=48
  -D RLYPIN=21
  -D IRPIN=15
  -D HW_PIN_SDA=42 ;; ESP32-S3 default: SDA = 8
  -D HW_PIN_SCL=41 ;; ESP32-S3 default: SCL = 9
  -D AUDIOPIN=-1
  -D SR_DMTYPE=1 -D I2S_SDPIN=16 -D I2S_CKPIN=17 -D I2S_WSPIN=47 -D MCLK_PIN=40
  -D ES7243_SDAPIN=8 -D ES7243_SCLPIN=18
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} 
  ${common_mm.HUB75_lib_deps}
  ${common_mm.animartrix_lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
board_build.partitions = tools/WLED_ESP32_8MB.csv
;; optimized-for-speed build
; RAM:   [===       ]  26.0% (used 85328 bytes from 327680 bytes)
; Flash: [========  ]  79.9% (used 1674885 bytes from 2097152 bytes)


;; for S3 with 16MB flash, octal PSRAM, 
;; MOONHUB HUB75 adapter board
[env:esp32S3_16MB_PSRAM_M_HUB75]
extends = env:esp32S3_8MB_PSRAM_M
;; we have enough flash - use standard espressif platform instead of tasmota
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
board = lilygo-t7-s3
board_build.arduino.memory_type = qio_opi
board_build.flash_mode = qio

build_unflags = ${env:esp32S3_8MB_PSRAM_M.build_unflags}
  -D WLED_RELEASE_NAME=esp32S3_8MB_M
  -D LEDPIN=21
  ${Speed_Flags.build_unflags}  ;; to override -Os

build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  ${Speed_Flags.build_flags_V4}  ;; optimize for speed
  ${common_mm.HUB75_build_flags}
  -D MOONHUB_S3_PINOUT ;; HUB75 pinout
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_GIF         ;; 28KB Flash
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLED_RELEASE_NAME=esp32S3_16MB_PSRAM_M_HUB75
  -D WLEDMM_FASTPATH
  -D WLED_DISABLE_BROWNOUT_DET
  ;; -D JSON_BUFFER_SIZE=18432 ;; default 54000
  -D MIN_HEAP_SIZE=6144      ;; default 8192
  -D MAX_SEGMENT_DATA=40960  ;; default 32767
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM ;; your board supports PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0     ;; for Serial-to-USB chip
  ;; -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1   ;; for Hardware-CDC USB mode
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ;; -DUSERMOD_BATTERY_MEASUREMENT_PIN=2  ;; battery voltage pin
  ;; -D STATUSLED=17 ;; onboard LED
  -D LEDPIN=14 -D BTNPIN=0 -D RLYPIN=15 -D IRPIN=-1 -D AUDIOPIN=-1 ;; defaults that avoid pin conflicts with HUB75
  -D SR_DMTYPE=1 -D I2S_SDPIN=10 -D I2S_CKPIN=11 -D I2S_WSPIN=12 -D MCLK_PIN=-1  ;; I2S mic

lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation

board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size =16777216
; RAM:   [==        ]  19.1% (used 62712 bytes from 327680 bytes)
; Flash: [======    ]  60.1% (used 1891929 bytes from 3145728 bytes)


;; MM for ESP32-S3 WROOM-2, a.k.a. ESP32-S3 DevKitC-1 v1.1
;; with 16MB FLASH and >= 8MB PSRAM (memory_type: opi_opi)
;; includes HUB75 and AnimArtix
[env:esp32S3_WROOM-2_M]
extends = env:esp32S3_8MB_PSRAM_M
;; tasmota platform
;; platform = ${esp32s3.platform}
;; platform_packages = ${esp32s3.platform_packages}
;; we have enough flash - use standard espressif platform instead of tasmota
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
board_build.flash_mode = dout ;; dummy value - bootloader will switch to "opi"
board_build.arduino.memory_type = opi_opi
board = esp32s3camlcd ;; this is the only standard board with "opi_opi"
board_upload.flash_size = 16MB
board_upload.maximum_size =16777216
board_build.partitions = ${esp32.extreme_partitions}
build_unflags = ${env:esp32S3_8MB_PSRAM_M.build_unflags}
  -D WLED_RELEASE_NAME=esp32S3_8MB_M
  -D LEDPIN=21
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  ${Speed_Flags.build_flags_V4}  ;; optimize for speed
  ${common_mm.HUB75_build_flags}
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLED_RELEASE_NAME=esp32S3_WROOM-2_M
  -D WLEDMM_FASTPATH
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM ;; your board supports PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0     ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1   ;; for Hardware-CDC USB mode
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ;; -D LEDPIN=38 ;; buildin LED
  ;; -D BTNPIN=0 -D RLYPIN=16 -D IRPIN=17 -D AUDIOPIN=-1
  -D LEDPIN=12 -D BTNPIN=0 -D RLYPIN=-1 -D IRPIN=-1 -D AUDIOPIN=-1 ;; to avoid pin conflict with HUB75
  -D SR_DMTYPE=1 -D I2S_SDPIN=13 -D I2S_CKPIN=14 -D I2S_WSPIN=15 -D MCLK_PIN=4  ;; I2S mic
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
    ${common_mm.HUB75_lib_deps}
    ${common_mm.animartrix_lib_deps}

;; MM for ESP32-S3 WROOM-2 with 32MB flash and PSRAM
[env:esp32S3_WROOM-2_M_32MB]
extends = env:esp32S3_WROOM-2_M
board_build.partitions = tools/WLED_ESP32_32MB.csv
board_upload.flash_size = 32MB
board_upload.maximum_size = 33554432
;; replace WLED_RELEASE_NAME, keep everything else
build_unflags = ${env:esp32S3_WROOM-2_M.build_unflags}
  -D WLED_RELEASE_NAME=esp32S3_WROOM-2_M
build_flags = ${env:esp32S3_WROOM-2_M.build_flags}
  -D WLED_RELEASE_NAME=esp32S3_WROOM-2_M_32MB


;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - fastpath, optimize for speed
[env:esp32S3_4MB_PSRAM_S]
extends = env:esp32S3_8MB_S
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM 
board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv   ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
;; board_build.partitions = tools/WLED_ESP32_4MB_512KB_FS.csv    ;; 1.7MB firmware, 500KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
build_unflags = ${common.build_unflags}
  -D WLED_ENABLE_HUB75MATRIX ;; board does not have enough pins for HUB75
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S}
  -D WLED_RELEASE_NAME=esp32S3_4MB_PSRAM_S
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - allows some buffers to use PSRAM
  -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1   ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  -D WLED_DISABLE_ADALIGHT    ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  ${Speed_Flags.build_flags_V4}  ;; optimize for speed instead of size
  -D WLEDMM_FASTPATH          ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
  ;; -D WLEDMM_SAVE_FLASH
  ${common_mm.animartrix_build_flags}
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes
  ;; -D WLED_DISABLE_ALEXA ;  RAM 116 bytes; FLASH 13524 bytes
  ;; -D WLED_DISABLE_MQTT ;   RAM 216 bytes; FLASH 16496 bytes
  ;; -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes
  -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes
  -D LEDPIN=21
  -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1
  -D HW_PIN_SDA=12 -D HW_PIN_SCL=13
  -D AUDIOPIN=-1
  -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
    ${common_mm.animartrix_lib_deps}
lib_ignore =
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ${common_mm.HUB75_lib_ignore}
  ${common_mm.DMXin_lib_ignore}
; RAM:   [==        ]  16.1% (used 52912 bytes from 327680 bytes)
; Flash: [=======   ]  66.2% (used 1257281 bytes from 1900544 bytes)

;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - standard
[env:esp32S3_4MB_PSRAM_M]
extends = env:esp32S3_8MB_M
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM 
board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB filesystem
build_unflags = ${common.build_unflags}
  -D WLED_ENABLE_HUB75MATRIX ;; board does not have enough pins for HUB75
  ;;-D USERMOD_ANIMARTRIX ;; not enough flash
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  -D WLED_RELEASE_NAME=esp32S3_4MB_PSRAM_M
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - allows some buffers to use PSRAM
  -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this
  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1   ;; for Serial-to-USB chip
  ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  -D WLED_DISABLE_ADALIGHT    ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  ;; ${common_mm.animartrix_build_flags} ;; not enough flash
  -D LEDPIN=21
  -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 -D AUDIOPIN=-1
  -D HW_PIN_SDA=12 -D HW_PIN_SCL=13
  -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7
  ;;-D WLED_DISABLE_LOXONE   ; FLASH 1272 bytes - disabled to stay below 100%
  ;;-D WLED_DISABLE_HUESYNC  ; RAM 122 bytes; FLASH  6308 bytes - disabled to stay below 100%
  ;;-D WLED_DISABLE_INFRARED ; RAM 136 bytes; FLASH 24492 bytes - disabled to stay below 100%
  ;; -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes
  ;; -D WLED_DISABLE_MQTT  ; RAM 216 bytes; FLASH 16496 bytes
  ;; -D WLEDMM_SAVE_FLASH
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  ; -D MIC_LOGGER
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S}  ${common_mm.lib_deps_V4_M}
lib_ignore =
  ;; IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ${common_mm.HUB75_lib_ignore}
  ${common_mm.DMXin_lib_ignore}
  ;; ${common_mm.animartrix_lib_ignore}
; RAM:   [==        ]  16.7% (used 54676 bytes from 327680 bytes)
; Flash: [========  ]  83.2% (used 1416997 bytes from 1703936 bytes)

# ------------------------------------------------------------------------------
# esp32-S2 environments
# ------------------------------------------------------------------------------


;; MM for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader
;; to ewowi - i'll optimize this entry later, as a few things can be inherited for sure. To softhack: sure ;-)
[env:esp32s2_tinyUF2_PSRAM_S]
extends = esp32_4MB_V4_S_base
;; tasmota platform needed, as we are over flash size limits for the standard platform
platform = ${esp32s2.platform}
platform_packages = ${esp32s2.platform_packages}

board = adafruit_qtpy_esp32s2
board_build.partitions = tools/partitions-4MB_spiffs-tinyuf2.csv ;; this is needed for tinyUF2 bootloader! Filename has to end in "tinyuf2.csv"
board_build.f_flash = 80000000L
board_build.flash_mode = qio
upload_speed = 256000 ;; 921600
build_unflags = ${common.build_unflags}
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
  -D WLED_ENABLE_DMX_INPUT ;; needs more testing
  -DWLEDMM_FASTPATH ;; needs more testing on -S2
  -DUSERMOD_RTC
  -D WLED_ENABLE_HUB75MATRIX

build_flags = ${common.build_flags} ${esp32s2.build_flags} 
  ; ${Debug_Flags.build_flags} ;ewowi: enabling debug causes Error: The program size (1463330 bytes) is greater than maximum allowed (1441792 bytes)
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ${common_mm.build_flags_S}
  -Wno-misleading-indentation -Wno-format-truncation
  -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - allows some buffers to use PSRAM
  -D WLED_RELEASE_NAME=esp32S2_4MB_UF2_S
  -DARDUINO_USB_CDC_ON_BOOT=1  ;; mandatory, otherwise USB does not work!!
  -D WLED_DISABLE_ADALIGHT     ;; disables serial protocols when using CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
  -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
  -D SERVERNAME='"WLED-S2"'
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -D WLED_DISABLE_LOXONE  ;;  FLASH 1272 bytes
  -D WLED_DISABLE_HUESYNC ;;   RAM 122 bytes; FLASH  6308 bytes
  -D WLED_DISABLE_ALEXA ;;     RAM 116 bytes; FLASH 13524 bytes
  ; -D WLED_DISABLE_MQTT ;;    RAM 216 bytes; FLASH 16496 bytes
  -D WLED_DISABLE_INFRARED ;;  RAM 136 bytes; FLASH 24492 bytes
  -D WLEDMM_SAVE_FLASH
  -D LEDPIN=39 ;; onboard neopixel LED. Attach your own LEDs to GPIO 7 or GPIO 6
  -D BTNPIN=0
  ;-D RLYPIN=6
  ;-D IRPIN=7
  -D HW_PIN_SCL=40 -D HW_PIN_SDA=41
  -D HW_PIN_MOSISPI=35 ;WLEDMM renamed from HW_PIN_DATASPI
  -D HW_PIN_CLOCKSPI=36
  -D HW_PIN_MISOSPI=37
  -D AUDIOPIN=-1
  -D SR_DMTYPE=1 -D I2S_SDPIN=9 -D I2S_WSPIN=8 -D I2S_CKPIN=17 -D MCLK_PIN=18
  ;-D STATUSLED=-1
  -D WLED_USE_MY_CONFIG
lib_deps = ${esp32s2.lib_deps} ${common_mm.lib_deps_S}
lib_ignore = 
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  OneWire         ; not needed as we don't include USERMOD_DALLASTEMPERATURE
monitor_filters = esp32_exception_decoder
; RAM:   [==        ]  17.9% (used 58728 bytes from 327680 bytes)
; Flash: [========  ]  83.6% (used 1204774 bytes from 1441792 bytes)

;; MM environment for generic ESP32-S2, with PSRAM, 4MB flash (300kB filesystem to have more program space)
;; PINs assignments optimized for use with serg74 "mini shield"
[env:esp32s2_PSRAM_M]
extends = esp32_4MB_V4_M_base
;; default tasmota platform
platform = ${esp32s2.platform}
platform_packages = ${esp32s2.platform_packages}
;; standard espressif platform (optional)
;; platform = ${esp32.platformV4}
;; platform_packages = ${esp32.platformV4_packages}

board = lolin_s2_mini
board_build.partitions = ${esp32.extended_partitions}   ;; 1.65MB firmware, 700KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
board_build.flash_mode = dio
upload_speed = 256000 ;; 921600
build_unflags = ${common.build_unflags}
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DARDUINO_USB_DFU_ON_BOOT=0
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
  -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
  -D WLED_ENABLE_DMX_INPUT ;; needs more testing
  -D WLED_ENABLE_HUB75MATRIX
build_flags = ${common.build_flags} ${esp32s2.build_flags} 
  ;; ${Debug_Flags.build_flags}
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  -Wno-misleading-indentation -Wno-format-truncation
  -D WLED_RELEASE_NAME=esp32s2_4MB_M
  -DBOARD_HAS_PSRAM ;; -D WLED_USE_PSRAM
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this
  -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1
  -D WLED_DISABLE_ADALIGHT     ;; disables serial protocols, as the board only has CDC USB
  -D WLED_DISABLE_INFRARED ;; save flash space
  ;;-D WLED_DISABLE_ALEXA    ;; save flash space
  ;;-D WLED_DISABLE_HUESYNC  ;; save flash space
  ;;-D WLED_DISABLE_LOXONE   ;; save flash space
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ;;-D WLEDMM_SAVE_FLASH
  -D AUDIOPIN=-1
  -D BTNPIN=-1 -D IRPIN=-1
  -D LEDPIN=16  ;; second led pin = 18
  -D HW_PIN_SCL=35 -D HW_PIN_SDA=33
  -D RLYPIN=9
  ;; -D HW_PIN_MOSISPI=11 -D HW_PIN_CLOCKSPI=7 -D HW_PIN_MISOSPI=9  ;; 9 already in use for RELAY, 7 for IR
  -D SR_DMTYPE=1 -D I2S_SDPIN=34 -D I2S_CKPIN=14 -D I2S_WSPIN=17 -D MCLK_PIN=-1 ;; recommended for mini shield
  ;; -D FFTTASK_PRIORITY=2  ;; useful for testing FFT timing. reduces audio latency, but makes effects slower.
  ;; -D STATUSLED=15
  -D WLED_USE_MY_CONFIG
lib_deps = ${esp32s2.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M}
lib_ignore = 
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  OneWire         ; not needed as we don't include USERMOD_DALLASTEMPERATURE
  ${common_mm.HUB75_lib_ignore}
  ${common_mm.DMXin_lib_ignore}
monitor_filters = esp32_exception_decoder
; RAM:   [==        ]  18.5% (used 60660 bytes from 327680 bytes)
; Flash: [========  ]  83.6% (used 1424518 bytes from 1703936 bytes)

[env:esp32s2_PSRAM_S]
extends = env:esp32s2_PSRAM_M
board_build.partitions = ${esp32.default_partitions}   ;; 1.55MB firmware, 1MB filesystem
build_unflags = ${env:esp32s2_PSRAM_M.build_unflags}
  -DWLED_DISABLE_ADALIGHT
  -D WLED_RELEASE_NAME=esp32s2_4MB_M
  -DUSE_ALT_DISPLAY
  -DUSERMOD_FOUR_LINE_DISPLAY
  -DUSERMOD_ROTARY_ENCODER_UI
  -DUSERMOD_ANIMARTRIX
  ;; -DUSERMOD_ARTIFX  ;; uncomment to reduce flash size
build_flags = ${env:esp32s2_PSRAM_M.build_flags}
  -D WLED_RELEASE_NAME=esp32s2_4MB_S
lib_deps = ${env:esp32s2_PSRAM_M.lib_deps}
lib_ignore =  ${env:esp32s2_PSRAM_M.lib_ignore}
  U8g2
  ${common_mm.animartrix_lib_ignore}
; RAM:   [==        ]  18.1% (used 59176 bytes from 327680 bytes)
; Flash: [========  ]  81.0% (used 1273946 bytes from 1572864 bytes)

# ------------------------------------------------------------------------------
# esp32-C3 environments
# ------------------------------------------------------------------------------


;; MM environment for generic ESP32-C3 -> 4MB flash, qio mode, no PSRAM
[env:esp32c3dev_4MB_M]
extends = esp32_4MB_V4_S_base
;board_build.flash_mode = dout
platform = ${esp32c3.platform}
platform_packages = ${esp32c3.platform_packages}
board_build.flash_mode = qio
board = esp32-c3-devkitm-1
;board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
;board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv    ;; use this for boards with 2MB flash (like some Ai-Thinker ESP32-C3-12F models)
upload_speed = 230400 ;; 460800 ;; 256000 ;; 921600

build_unflags = ${common.build_unflags}
  -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S2 (autodetect broken?)
  -D USE_ALT_DISPLAY ;; four line display seems to have problems with I2C - it hangs during usermod setup
  -D USERMOD_FOUR_LINE_DISPLAY ;; see above
  -D USERMOD_ROTARY_ENCODER_UI ;; see above
  -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
  -D WLED_ENABLE_DMX_INPUT ;; needs more testing
  ;-D WLED_DEBUG_HOST='"192.168.x.x"' ;; to disable net print
  ${common_mm.animartrix_build_flags} ;; Tips our memory usage over the limit
  -DUSERMOD_ARTIFX      ;; over the limit
  ; -DWLED_ENABLE_FULL_FONTS ;; removing full unicode support saves 10KB of flash

build_flags = ${common.build_flags} ${esp32c3.build_flags} 
  ; -D WLED_DISABLE_OTA          ;;  OTA is not possible for boards with 2MB flash only (like some Ai-Thinker ESP32-C3-12F models)
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ${common_mm.build_flags_S} ${common_mm.build_flags_M}
  -Wno-misleading-indentation -Wno-format-truncation
  -D WLED_RELEASE_NAME=esp32c3dev_4MB_M
  ; -D WLED_DISABLE_BROWNOUT_DET
  ; -DARDUINO_USB_CDC_ON_BOOT=1  ;; enable CDC USB -> needed for debugging over serial USB
  -D WLED_DISABLE_ADALIGHT     ;; to disable serial protocols for boards with CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
  -DARDUINO_USB_CDC_ON_BOOT=0    ;; disable CDC USB
  -D SERVERNAME='"WLED-C3"'
  -D WLEDMM_WIFI_POWERON_HACK -DLOLIN_WIFI_FIX ;; use this _only_ if your device is not able to make a WiFI connection!
  ;-D WLED_DISABLE_INFRARED ;; save flash space
  ;-D WLED_DISABLE_ALEXA    ;; save flash space
  ;-D WLEDMM_SAVE_FLASH
  -D LEDPIN=8 ;; onboard neopixel 5x5 Matrix. Attach your own LEDs to GPIO 20
  -D BTNPIN=9
  ; -D STATUSLED=10 ;; onboard LED
  -D RLYPIN=-1 -D IRPIN=-1
  ;-D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; for I2C Qwiic connector
  -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7
  ; -D WLED_USE_MY_CONFIG
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32c3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M}
lib_ignore = 
  ;IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  OneWire         ; not needed as we don't include USERMOD_DALLASTEMPERATURE
  U8g2            ; not needed as we don't include USERMOD_FOUR_LINE_DISPLAY
  ${common_mm.animartrix_lib_ignore} ;; Tips our memory usage over the limit
  ${esp32c3.lib_ignore}
; RAM:   [==        ]  22.1% (used 72408 bytes from 327680 bytes)
; Flash: [========  ]  83.5% (used 1313420 bytes from 1572864 bytes)

;; MM environment for ESP32-C3 "mini" and "super mini" -> flash mode "dio" instead of "qio" (see #101)
[env:esp32c3mini_dio_4MB_M]
extends = env:esp32c3dev_4MB_M
board = lolin_c3_mini
board_build.flash_mode = dio ;; some super-mini boards are unstable with "qio" mode
;; board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; optional: 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
;;; replace WLED_RELEASE_NAME, disable CDC_ON_BOOT
build_unflags = ${env:esp32c3dev_4MB_M.build_unflags}
  -DARDUINO_USB_CDC_ON_BOOT=1
  -D WLED_RELEASE_NAME=esp32c3dev_4MB_M
build_flags = ${env:esp32c3dev_4MB_M.build_flags}
  -DARDUINO_USB_CDC_ON_BOOT=0
  -D WLED_RELEASE_NAME=esp32c3mini_dio_4MB_M
  -D WLED_DISABLE_BROWNOUT_DET    ;; the board only has a 500mA LDO, better to disable brownout detection
  -D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; avoid pin conflicts
; RAM:   [==        ]  22.0% (used 72240 bytes from 327680 bytes)
; Flash: [========  ]  83.4% (used 1311474 bytes from 1572864 bytes)

[env:esp32c3dev_2MB_M]
extends = env:esp32c3dev_4MB_M
board = lolin_c3_mini
;;; replace WLED_RELEASE_NAME, disable CDC_ON_BOOT
build_unflags = ${env:esp32c3dev_4MB_M.build_unflags}
  ;; -DWLED_ENABLE_FULL_FONTS ;; removing full unicode support saves 10KB of flash
  -DARDUINO_USB_CDC_ON_BOOT=1
  -D WLED_RELEASE_NAME=esp32c3dev_4MB_M

;;; 2MB Flash, no OTA
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
board_build.flash_mode = dio
board_upload.flash_size = 2MB
board_upload.maximum_size = 2097152

build_flags = ${env:esp32c3dev_4MB_M.build_flags}
  -D WLED_WATCHDOG_TIMEOUT=0
  -D WLED_DISABLE_OTA
  ; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
  -DARDUINO_USB_CDC_ON_BOOT=0   ;; for serial-to-USB chip
  -D WLED_RELEASE_NAME=esp32c3dev_2MB_M
  -D WLED_DISABLE_BROWNOUT_DET    ;; the board only has a 500mA LDO, better to disable brownout detection
  ; -D WLED_DISABLE_ADALIGHT        ;; to disable serial protocols for boards with CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
  -D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; avoid pin conflicts
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
; RAM:   [==        ]  21.5% (used 70296 bytes from 327680 bytes)
; Flash: [========  ]  82.5% (used 1297438 bytes from 1572864 bytes)

;; MM environment for "seeed xiao -C3" boards
[env:seeed_esp32c3_4MB_S]
extends = env:esp32c3dev_4MB_M
board = seeed_xiao_esp32c3
platform = ${esp32.platformV4_pre}                             ;; older espressif ESP-IDF v4.4.1 platform - seems to work better for seeed xiao board
platform_packages = ${esp32.platformV4_packages_pre}
board_build.flash_mode = dio
upload_speed = 460800
build_unflags = ${env:esp32c3dev_4MB_M.build_unflags}
  -D WLED_ENABLE_HUB75MATRIX ;; not enough pins
  -DARDUINO_USB_CDC_ON_BOOT=1 ;; hangs on boot
  ; -DWLED_ENABLE_FULL_FONTS ;; removing full unicode support saves 10KB of flash
build_flags = ${common.build_flags} ${esp32c3.build_flags} 
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  ${common_mm.build_flags_S} -Wno-misleading-indentation -Wno-format-truncation
  -D WLED_RELEASE_NAME=seeed_esp32c3_4MB_S
  -DARDUINO_USB_CDC_ON_BOOT=0  ;; disable CDC USB, as the older framework has problems with it
  -D WLED_DISABLE_ADALIGHT     ;; to disable serial protocols when using CDC USB (Serial RX pin will receive junk commands, unless its pulled down by resistor)
  -D WLED_DISABLE_INFRARED  ;; save flash space
  ;-D WLED_DISABLE_ALEXA    ;; save flash space
  ;-D WLED_DISABLE_HUESYNC  ;; save flash space
  ;-D WLED_DISABLE_LOXONE   ;; save flash space
  ;; -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
  ;; -D WLEDMM_SAVE_FLASH
  ;-D WLEDMM_WIFI_POWERON_HACK -DLOLIN_WIFI_FIX ;; use this _only_ if your device is not able to make a WiFI connection!
  -D LEDPIN=3  ;; attach your LEDs to GPIO3 aka "D1" / "A1"
  -D BTNPIN=9
  -D RLYPIN=-1 -D IRPIN=-1
  -D SR_DMTYPE=1 
  -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7
  -D WLED_USE_MY_CONFIG
  ;-D WLED_DEBUG -D SR_DEBUG
lib_deps = ${esp32c3.lib_deps} ${common_mm.lib_deps_S}
lib_ignore = 
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ${esp32c3.lib_ignore}
monitor_filters = esp32_exception_decoder
; RAM:   [==        ]  22.5% (used 73740 bytes from 327680 bytes)
; Flash: [==========]  96.3% (used 1515336 bytes from 1572864 bytes)

# ------------------------------------------------------------------------------
# custom board environments
# ------------------------------------------------------------------------------


# ------------------------------------------------------------------------------
# wemos shields
# ------------------------------------------------------------------------------
;https://www.tindie.com/products/serg74/wled-shield-board-for-addressable-leds/
;https://www.tindie.com/products/moonmodules/shield-board-for-esp32-for-wled-addressable-leds/
[wemos_shield_esp32_4MB_S_base]
extends = esp32_4MB_S_base
pinout_build_flags = 
  -D ABL_MILLIAMPS_DEFAULT=9500 ; Wemos max 10A
  -D LEDPIN=16
  -D RLYPIN=19
  -D BTNPIN=17
  -D IRPIN=18
  -D AUDIOPIN=-1 
  -D TEMPERATURE_PIN=23
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  -D HW_PIN_SCL=22 -D HW_PIN_SDA=21
  -D HW_PIN_CLOCKSPI=-1 -D HW_PIN_MOSISPI=-1 -D HW_PIN_MISOSPI=-1 ; WLEDMM: is now also default but just to show we didn't agree on wemos pins for spi yet
  -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=5  ; WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
  -D PIR_SENSOR_PIN=-1
  -D PWM_PIN=-1
  ; -D WLED_USE_MY_CONFIG
build_flags = ${esp32_4MB_S_base.build_flags} ${common_mm.build_disable_sync_interfaces} ${wemos_shield_esp32_4MB_S_base.pinout_build_flags}

[wemos_shield_esp32_4MB_M_base]
extends = wemos_shield_esp32_4MB_S_base
build_flags =  ${esp32_4MB_M_base.build_flags} ${wemos_shield_esp32_4MB_S_base.pinout_build_flags}
lib_deps = ${wemos_shield_esp32_4MB_S_base.lib_deps} ${common_mm.lib_deps_M}

[wemos_shield_esp32_4MB_XL_base]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${common_mm.build_flags_XL}
lib_deps = ${wemos_shield_esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL}

[env:wemos_shield_esp32_4MB_S]
extends = wemos_shield_esp32_4MB_S_base
build_flags = ${wemos_shield_esp32_4MB_S_base.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_S
; RAM:   [===       ]  25.4% (used 83124 bytes from 327680 bytes)
; Flash: [========  ]  83.4% (used 1311629 bytes from 1572864 bytes)

[env:wemos_shield_esp32_4MB_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_M
; RAM:   [===       ]  26.0% (used 85252 bytes from 327680 bytes)
; Flash: [==========]  97.4% (used 1531865 bytes from 1572864 bytes)

[env:wemos_shield_esp32_4MB_ICS4343x_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_ICS4343x.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_ICS4343x_M
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ]  88.6% (used 1393421 bytes from 1572864 bytes)

[env:wemos_shield_esp32_4MB_SPM1423_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_SPM1423.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_SPM1423_M
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ]  88.6% (used 1393421 bytes from 1572864 bytes)

[env:wemos_shield_esp32_4MB_LineIn_M]
extends = wemos_shield_esp32_4MB_M_base
build_unflags = ${common.build_unflags} ${Shield_LineIn.build_unflags}
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_LineIn.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_LineIn_M

[env:wemos_shield_esp32_16MB_S]
extends = wemos_shield_esp32_4MB_S_base
build_flags = ${wemos_shield_esp32_4MB_S_base.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_S
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem

[env:wemos_shield_esp32_16MB_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_M
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
;board_build.flash_mode = qio
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [=======   ]  66.4% (used 1393421 bytes from 2097152 bytes)

[env:wemos_shield_esp32_16MB_ICS4343x_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_ICS4343x.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_ICS4343x_M
board = esp32_16MB 
board_build.partitions = tools/WLED_ESP32_16MB.csv
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ]  88.6% (used 1393421 bytes from 1572864 bytes)

[env:wemos_shield_esp32_16MB_ICS4343x_XL]
extends = wemos_shield_esp32_4MB_XL_base
build_flags = ${wemos_shield_esp32_4MB_XL_base.build_flags} ${Shield_ICS4343x.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_ICS4343x_XL
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
; RAM:   [==        ]  24.4% (used 80044 bytes from 327680 bytes)
; Flash: [=======   ]  67.9% (used 1424185 bytes from 2097152 bytes)

[env:wemos_shield_esp32_16MB_SPM1423_M]
extends = wemos_shield_esp32_4MB_M_base
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_SPM1423.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_SPM1423_M
board = esp32_16MB
;board_build.partitions = tools/WLED_ESP32_16MB.csv        ;; WLED standard for 16MB flash:    2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ]  88.6% (used 1393421 bytes from 1572864 bytes)

[env:wemos_shield_esp32_16MB_SPM1423_XL]
extends = wemos_shield_esp32_4MB_XL_base
build_flags = ${wemos_shield_esp32_4MB_XL_base.build_flags} ${Shield_SPM1423.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_SPM1423_XL
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem
; RAM:   [==        ]  24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ]  88.6% (used 1393421 bytes from 1572864 bytes)

[env:wemos_shield_esp32_16MB_LineIn_M]
extends = wemos_shield_esp32_4MB_M_base
build_unflags = ${common.build_unflags} ${Shield_LineIn.build_unflags}
build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} ${Shield_LineIn.build_flags}
  -D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_LineIn_M
board = esp32_16MB 
;board_build.partitions = tools/WLED_ESP32_16MB.csv         ;; WLED standard for 16MB flash:   2MB firmware, 12 MB filesystem
board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB flash: 3.2MB firmware,  9 MB filesystem


# ------------------------------------------------------------------------------
# special boards and controlers
# ------------------------------------------------------------------------------

;https://www.athom.tech/blank-1/wled-esp32-music-addressable-led-strip-controller
;; "V3" build environment
[env:athom_music_esp32_4MB_M]
extends = esp32_4MB_M_base
build_unflags = ${esp32_legacy.build_unflags}
  ${common_mm.animartrix_build_flags}  ;; exceeds flash limits in V3 builds
  -D USERMOD_ARTIFX ;; disabled to save some program space in flash
  -D USERMOD_DALLASTEMPERATURE ;; disabled - flash space is too tight for this
  -D USERMOD_ROTARY_ENCODER_UI ;; see above
  ${common_mm.DMXin_build_flags}
build_flags = ${esp32_4MB_M_base.build_flags} 
  ${Athom_PDMmic.build_flags}
  -D WLED_AP_SSID_UNIQUE
  -D WLED_RELEASE_NAME=athom_music_esp32_4MB_M
  -D ABL_MILLIAMPS_DEFAULT=14500 ; max 15A
  ; -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ADALIGHT ;to get 4ld working
  -D BTNPIN=0 -D RLYPIN=2 -D IRPIN=25 -D IRTYPE=9 -D LEDPIN=18
  -D AUDIOPIN=-1 
  ; -D TEMPERATURE_PIN=23
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  -D HW_PIN_SCL=3 -D HW_PIN_SDA=1 ;4ld uses rx and tx
  -D HW_PIN_CLOCKSPI=-1 -D HW_PIN_MOSISPI=-1 -D HW_PIN_MISOSPI=-1 ; WLEDMM: is now also default but just to show we didn't agree on wemos pins for spi yet
  ; -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=5  ; WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
  ; -D PIR_SENSOR_PIN=-1
  ; -D PWM_PIN=-1
  ; -D WLED_USE_MY_CONFIG
  ; -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D WLEDMM_SAVE_FLASH        ;; -7KB Flash
lib_ignore = ${esp32_4MB_M_base.lib_ignore}
  ${common_mm.DMXin_lib_ignore}
; RAM:   [==        ]  24.2% (used 79420 bytes from 327680 bytes)
; Flash: [==========]  96.2% (used 1513633 bytes from 1572864 bytes)

;; "V4" build environment (tasmota core)
[env:athom_music_esp32_4MB_V4_M]
extends = esp32_4MB_V4_M_base
platform = ${esp32.platform} ;; "V4" tasmota
platform_packages = ${esp32.platform_packages}
build_unflags = ${esp32_4MB_V4_M_base.build_unflags} ;; ${common_mm.build_disable_sync_interfaces}
  ${common_mm.animartrix_build_flags}  ;; exceeds flash limits, no pins for HUB75
  ; -D USERMOD_ARTIFX ;; disabled to save some program space in flash
  -D USERMOD_DALLASTEMPERATURE ;; disabled - flash space is too tight for this
  -D USERMOD_ROTARY_ENCODER_UI ;; see above
  -D WLED_DISABLE_ALEXA
  -D WLED_DISABLE_MQTT
  -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_HUESYNC
  ${common_mm.DMXin_build_flags}
build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags}
  ${Athom_PDMmic.build_flags}
  -D WLED_AP_SSID_UNIQUE
  -D WLED_RELEASE_NAME=athom_music_esp32_4MB_V4_M
  -D ABL_MILLIAMPS_DEFAULT=14500 ; max 15A
  ; -D WLED_DISABLE_MQTT
  ; -D WLED_DISABLE_LOXONE
  -D WLED_DISABLE_ADALIGHT ;to get 4ld working
  -D BTNPIN=0 -D RLYPIN=2 -D IRPIN=25 -D IRTYPE=9 -D LEDPIN=18
  -D AUDIOPIN=-1 
  ; -D TEMPERATURE_PIN=23
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  -D HW_PIN_SCL=3 -D HW_PIN_SDA=1 ;4ld uses rx and tx
  -D HW_PIN_CLOCKSPI=-1 -D HW_PIN_MOSISPI=-1 -D HW_PIN_MISOSPI=-1 ; WLEDMM: is now also default but just to show we didn't agree on wemos pins for spi yet
  ; -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=39 -D ENCODER_SW_PIN=5  ; WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
  ; -D PIR_SENSOR_PIN=-1
  ; -D PWM_PIN=-1
  ; -D WLED_USE_MY_CONFIG
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps}
lib_ignore =
  ${common_mm.DMXin_lib_ignore}
; RAM:   [==        ]  24.0% (used 78568 bytes from 327680 bytes)
; Flash: [========  ]  82.3% (used 1402341 bytes from 1703936 bytes)


;https://shop.myhome-control.de/Elektronik/
;; "V3" build environment
[env:abc_wled_controller_v43_S]
extends = esp32_4MB_S_base
build_unflags = ${esp32_4MB_S_base.build_unflags} ${common_mm.build_disable_sync_interfaces}
build_flags = ${esp32_4MB_S_base.build_flags}
  -D WLED_RELEASE_NAME=abc_wled_controller_v43_S
  -D LEDPIN=16
  -D ABL_MILLIAMPS_DEFAULT=5000 ; 5A default. Max 13A depending on the wires connected
  -D WLED_USE_ETHERNET
  -D WLED_ETH_DEFAULT=9 ; ABC! WLED V43 & compatible
  -D RLYPIN=-1 -D BTNPIN=-1 ;; Prevent clash
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D AUDIOPIN=-1 
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  ; -D WLED_USE_MY_CONFIG
  -D SR_DMTYPE=4 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=14 -D MCLK_PIN=0 ; generic i2s with mclk 0
  -D SR_SQUELCH=1 -D SR_GAIN=60    ; increrase squelch if noise, in test 0 is okay, but only slightly
  -D SR_FREQ_PROF=1                ; Generic line in
; RAM:   [==        ]  24.2% (used 79452 bytes from 327680 bytes)
; Flash: [========= ]  94.8% (used 1490405 bytes from 1572864 bytes)

;; "V4" build environment (tasmota core)
[env:abc_wled_controller_v43_V4_S]
extends = esp32_4MB_V4_S_base
platform = ${esp32.platform} ;; "V4" tasmota
platform_packages = ${esp32.platform_packages}
build_unflags = ${esp32_4MB_V4_S_base.build_unflags} ;; ${common_mm.build_disable_sync_interfaces}
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  -D WLED_RELEASE_NAME=abc_wled_controller_v43_V4_S
  -D LEDPIN=16
  -D ABL_MILLIAMPS_DEFAULT=5000 ; 5A default. Max 13A depending on the wires connected
  -D WLED_USE_ETHERNET
  -D WLED_ETH_DEFAULT=9 ; ABC! WLED V43 & compatible
  -D RLYPIN=-1 -D BTNPIN=-1 ;; Prevent clash
  -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ;-D WLEDMM_SAVE_FLASH       ;; -7KB Flash
  -D AUDIOPIN=-1 
  -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
  ; -D WLED_USE_MY_CONFIG
  -D SR_DMTYPE=4 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=14 -D MCLK_PIN=0 ; generic i2s with mclk 0
  -D SR_SQUELCH=1 -D SR_GAIN=60    ; increrase squelch if noise, in test 0 is okay, but only slightly
  -D SR_FREQ_PROF=1                ; Generic line in
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
lib_ignore =
  ${common_mm.HUB75_lib_ignore}
; RAM:   [==        ]  23.8% (used 77864 bytes from 327680 bytes)
; Flash: [========  ]  78.3% (used 1334161 bytes from 1703936 bytes)


; ESP32 WLED pico board with builtin ICS-43432 microphpone
[env:esp32_pico_4MB_M]
extends = esp32_4MB_M_base
board = pico32
board_build.flash_mode = dio ;; (dout = dual out; more compatible than qio = quad i/o)
upload_speed = 256000 ;; or 115200 ;; or 460800 ; or 921600  (slower speeds are better when flashing without a soldered connection)

build_flags = ${esp32_4MB_M_base.build_flags}
  -D WLED_RELEASE_NAME=esp32_pico_4MB_M
  -D WLED_DISABLE_BROWNOUT_DET
  -D SERVERNAME='"WLED-pico32"'
  ; -D WLED_WATCHDOG_TIMEOUT=60 
  -D WLED_DISABLE_ADALIGHT  ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128)
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  -D LEDPIN=2
  -D RLYPIN=19
  -D BTNPIN=0
  -D IRPIN=-1 -D TEMPERATURE_PIN=-1                               ;; no default pins for IR, DallasTemp
  -D ENCODER_DT_PIN=-1 -D ENCODER_CLK_PIN=-1 -D ENCODER_SW_PIN=-1 ;; no default pins for Rotary
  -D HW_PIN_SCL=22 -D HW_PIN_SDA=21
  -D SR_DMTYPE=1 -D I2S_SDPIN=25 -D I2S_WSPIN=15 -D I2S_CKPIN=14
  -D SR_SQUELCH=5 -D SR_GAIN=30 -D SR_FREQ_PROF=5                 ;; ICS-4343x specific
  ; -D MCLK_PIN=0
  -D SR_ENABLE_DEFAULT  ;; enable at first start - no need to manually set "enable", then reboot
  ; -D WLED_USE_MY_CONFIG
  -D WLED_DISABLE_LOXONE ;; exceeds flash size limits
  ; -D WLED_DISABLE_ALEXA
  ; -D WLED_DISABLE_HUESYNC
  ; -D WLED_DISABLE_MQTT
  ; -D WLED_DISABLE_INFRARED
  ; -D WLED_ENABLE_DMX
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
  ; -D WLED_ENABLE_PIXART      ;; 8KB Flash
  ; -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  ;; -D WLED_DISABLE_PARTICLESYSTEM2D
; RAM:   [==        ]  24.2% (used 79424 bytes from 327680 bytes)
; Flash: [==========]  99.9% (used 1571177 bytes from 1572864 bytes)

;; experimental
;; PICO environment with ESP-IDF v4.4.4 / arduino-esp32 v2.0.9
[env:esp32_pico_4MB_V4_S]
extends = esp32_4MB_V4_S_base
board = pico32
upload_speed = 256000 ;; or 115200 ;; or 460800 ; or 921600  (slower speeds are better when flashing without a soldered connection)

build_unflags = ${esp32_4MB_V4_S_base.build_unflags}
  -D WLED_ENABLE_HUB75MATRIX ;; not enough pins
  ${common_mm.DMXin_build_flags} ;; board is too small, no pins
build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags}
  -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup
  -D WLED_RELEASE_NAME=esp32_pico_4MB_V4_S
  -D WLED_DISABLE_BROWNOUT_DET
  -D SERVERNAME='"WLED-pico32-V4"'
  -D WLED_WATCHDOG_TIMEOUT=0
  ; -D WLED_WATCHDOG_TIMEOUT=60
  -D WLED_DISABLE_ADALIGHT  ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128)
  ${common_mm.NetDebug_build_flags}  ;; net debug is not included in normal _S builds
  ; -D WLED_DEBUG
  ; -D SR_DEBUG
  -D LEDPIN=2
  -D RLYPIN=-1 -D BTNPIN=-1 -D IRPIN=-1
  -D HW_PIN_SCL=22 -D HW_PIN_SDA=21
  -D SR_DMTYPE=1 -D I2S_SDPIN=25 -D I2S_WSPIN=15 -D I2S_CKPIN=14
  -D SR_SQUELCH=5 -D SR_GAIN=30 -D SR_FREQ_PROF=5                ; ICS-4343x specific
  ; -D MCLK_PIN=0
  -D SR_ENABLE_DEFAULT  ;; enable audioreactive at first start - no need to manually set "enable", then reboot
  ; -D WLED_USE_MY_CONFIG
  -D WLEDMM_SAVE_FLASH
  -D WLED_DISABLE_ESPNOW  ;; might help in case of WiFi connectivity problems
  ;;-D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit (default_partitions only)
  ;;-D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit (default_partitions only)
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
lib_ignore = 
  IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
  ${common_mm.HUB75_lib_ignore}
  ${common_mm.DMXin_lib_ignore}
; RAM:   [===       ]  26.0% (used 85100 bytes from 327680 bytes)
; Flash: [========= ]  90.0% (used 1534269 bytes from 1703936 bytes)

[env:adafruit_matrixportal_esp32s3_wled]
; ESP32-S3 processor, 8 MB flash, 2 MB of PSRAM, dedicated driver pins for HUB75
extends = esp32_4MB_V4_M_base
platform = ${esp32.platformV4_xp} ;; 6.5.0 = first platform release supporting matrixportal
platform_packages = ${esp32.platformV4_packages_xp} ;; arduino-esp32 2.0.14 needed - previous versions were missing files for matrixportal
board = adafruit_matrixportal_esp32s3_wled

board_build.partitions = ${esp32.large_partitions}    ;; default 8MB WLED partitions
;; board_build.f_flash = 80000000L ;; this is the default for board = adafruit_matrixportal_esp32s3
;; board_build.flash_mode = qio    ;; ditto

build_unflags = ${env:esp32S3_8MB_M.build_unflags}   ;; use the same as "normal" S3 buildenv
  -D ARDUINO_USB_CDC_ON_BOOT=1                       ;; fix warning: "ARDUINO_USB_CDC_ON_BOOT" redefined; comment out for Serial debug
  ${Speed_Flags.build_unflags}  ;; to override -Os
build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation
  ${common_mm.build_flags_S}
  ${Speed_Flags.build_flags_V4}  ;; -O2 -> optimize for speed instead of size
  -D WLED_RELEASE_NAME=matrixportal_esp32s3
  -D SERVERNAME='"WLED-MatrixPortalS3"'
  ; Serial debug enabled  -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode
  -D ARDUINO_USB_CDC_ON_BOOT=0
  -D WLED_DISABLE_ADALIGHT     ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor)
  ${common_mm.animartrix_build_flags}
  ${common_mm.build_disable_sync_interfaces}
  -D WLED_ENABLE_PIXART      ;; 8KB Flash
  -D WLED_ENABLE_PIXELFORGE  ;; 12KB Flash
  -D LOLIN_WIFI_FIX ;; try this in case Wifi does not work
  -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used
  -D WLED_USE_PSRAM_JSON -DALL_JSON_TO_PSRAM ; WLEDMM --> force all JSON stuff into PSRAM; gives more free heap
  ; -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - seems to move more buffers into PSRAM
  ${common_mm.HUB75_build_flags}
  -D DEFAULT_LED_TYPE=101
lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ;; ;;  do not include ${esp32.lib_depsV4} !!!!
  ${common_mm.animartrix_lib_deps}
  ${common_mm.HUB75_lib_deps}

lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
monitor_filters = esp32_exception_decoder
; 
; RAM:   [==        ]  18.4% (used 60456 bytes from 327680 bytes)
; Flash: [========  ]  79.9% (used 1675601 bytes from 2097152 bytes)

;; this buildenv uses the original bootloader and partions from adafruit
[env:adafruit_matrixportal_esp32s3_tinyUF2]
extends = env:adafruit_matrixportal_esp32s3_wled
board_build.partitions = tools/partitions-8MB_spiffs-tinyuf2.csv    ;; use original adafruit 8MB tinyUF2 partitioning
;; we just replace WLED_RELEASE_NAME
build_unflags = ${env:adafruit_matrixportal_esp32s3_wled.build_unflags}
  -D WLED_RELEASE_NAME=matrixportal_esp32s3
build_flags = ${env:adafruit_matrixportal_esp32s3_wled.build_flags}
  -D WLED_RELEASE_NAME=matrixportal_esp32s3_tinyUF2
; 
; RAM:   [==        ]  18.4% (used 60456 bytes from 327680 bytes)
; Flash: [========  ]  79.9% (used 1675601 bytes from 2097152 bytes)

[env:adafruit_matrixportal_esp32s3]
;; this buildenv is just an alias for the matrixportal UF2 build, to keep 3rd party build tools happy.
extends = env:adafruit_matrixportal_esp32s3_wled
