#
# PlatformIO Project Configuration File
# Cible release : Freenove FNK0102H / Freenove ESP32-S3 WROOM N16R8
#
[platformio]
default_envs = freenove_esp32s3_full_with_ui
src_dir = ui_freenove_allinone

; ===================== freenove_esp32s3_full_with_ui =====================

[env:freenove_esp32s3_full_with_ui]
platform = espressif32@6.5.0
# Physical board profile: Freenove ESP32-S3 WROOM N16R8 (16MB flash / 8MB PSRAM)
board = freenove_esp32_s3_wroom
framework = arduino
extra_scripts = pre:scripts/pio_prepare_webui_fonts.py
board_build.flash_size = 16MB
board_upload.flash_size = 16MB
board_upload.maximum_size = 4194304
board_upload.offset_address = 0x20000
board_build.partitions = partitions/freenove_esp32s3_app4mb_fs12096kb.csv
board_build.filesystem = littlefs
build_src_filter =
  -<*>
  +<src/>
monitor_speed = 115200
monitor_filters = time, esp32_exception_decoder
monitor_echo = yes
monitor_eol = LF
monitor_rts = 0
monitor_dtr = 0
lib_deps =
  bodmer/TFT_eSPI@2.5.43
  lovyan03/LovyanGFX@1.2.7
  lvgl/lvgl@8.4.0
  esphome/ESP32-audioI2S@2.3.0
  bblanchon/ArduinoJson@6.21.5
  adafruit/Adafruit NeoPixel@1.12.3
  links2004/WebSockets@^2.4.0
build_flags =
  -I$PROJECT_DIR/ui_freenove_allinone/include
  -I$PROJECT_DIR/ui_freenove_allinone/include/security
  -I$PROJECT_DIR/lib/zacus_story_portable/include
  -O2
  -ffast-math
  -DCORE_DEBUG_LEVEL=0
  -DARDUINO_LOOP_STACK_SIZE=24576
  -DZACUS_SPRINT_DIAG_MODE=0
  -DBOARD_HAS_PSRAM
  -DFREENOVE_USE_PSRAM=1
  -DFREENOVE_PSRAM_UI_DRAW_BUFFER=1
  -DFREENOVE_PSRAM_CAMERA_FRAMEBUFFER=1
  -DZACUS_FW_VERSION=\"freenove_esp32s3\"
  -DUSE_LVGL=1
  -DUSE_AUDIO=1
  -DUSE_CAM=1
  -DUSE_SD=1
  -DUI_COLOR_256=0
  -DUI_COLOR_565=1
  -DUI_FORCE_THEME_256=0
  -DUI_DRAW_BUF_LINES=16
  -DUI_DRAW_BUF_IN_PSRAM=1
  -DUI_AUDIO_RINGBUF_IN_PSRAM=1
  -DUI_CAMERA_FB_IN_PSRAM=1
  -DUI_DMA_TX_IN_DRAM=1
  -DUI_DMA_FLUSH_ASYNC=1
  -DUI_DMA_RGB332_ASYNC_EXPERIMENTAL=0
  -DUI_DMA_TRANS_BUF_LINES=1
  -DUI_ENABLE_SIMD_PATH=1
  -DUI_SIMD_EXPERIMENTAL=0
  -DUI_SIMD_USE_ESP_DSP=1
  -DUI_FULL_FRAME_BENCH=0
  -DUI_DEMO_AUTORUN_WIN_ETAPE=0
  -DUI_WIN_ETAPE_SIMPLIFIED=0
  -DUI_FX_BACKEND_LGFX=1
  -DUI_FX_DMA_BLIT=0
  -DUI_BOING_SHADOW_ASM=1
  -DUI_FX_SPRITE_W=160
  -DUI_FX_SPRITE_H=120
  -DUI_FX_TARGET_FPS=12
  -DFREENOVE_ENABLE_TASK_TOPOLOGY=0
  -DUI_LV_MEM_SIZE_KB=96
  -DUI_FONT_PIXEL_ENABLE=1
  -DUI_FONT_TITLE_XL_ENABLE=1
  -DUI_ENABLE_MEM_MONITOR=0
  -DUI_ENABLE_PERF_MONITOR=0
  -DLV_CONF_INCLUDE_SIMPLE=1
  -DFREENOVE_MEDIA_KIT
  -include ui_freenove_config.h
  -DTFT_RGB_ORDER=TFT_BGR
  -DFREENOVE_LCD_VARIANT_FNK0102A=0
  -DFREENOVE_LCD_VARIANT_FNK0102B=0
  -DFREENOVE_LCD_VARIANT_FNK0102H=1
  -DFREENOVE_LCD_USE_HSPI=1
  -DZACUS_AUTH_ENABLED=1
  -DFREENOVE_HAS_TOUCH=0

[env:freenove_esp32s3]
extends = env:freenove_esp32s3_full_with_ui

[env:freenove_esp32s3_touch]
extends = env:freenove_esp32s3_full_with_ui
# Experimental only: release builds keep touch disabled because the official
# FNK0102H profile is the 5-way switch, and GPIO9/GPIO15 are already used by camera wiring.
build_unflags =
  -DFREENOVE_HAS_TOUCH=0
build_flags =
  ${env:freenove_esp32s3_full_with_ui.build_flags}
  -DFREENOVE_HAS_TOUCH=1

#
# Builder :        pio run
# Flasher :        pio run -t upload
# Monitor :        pio device monitor
# Filesystem :     pio run -t uploadfs
#
