; ===========================================================================
; LilyGo T5 S3 E-Paper Pro (H752-B / V2 hardware)
; 4.7" parallel e-ink (960x540), GT911 touch, SX1262 LoRa, no keyboard
; ===========================================================================
;
; Place t5s3-epaper-pro.json in boards/ directory.
; Place variant files in variants/LilyGo_T5S3_EPaper_Pro/
; Place FastEPDDisplay.h/.cpp in src/helpers/ui/
;

[LilyGo_T5S3_EPaper_Pro]
extends = esp32_base
extra_scripts = post:merge_firmware.py
board = t5s3-epaper-pro
board_build.flash_mode = qio
board_build.f_flash = 80000000L
board_build.arduino.memory_type = qio_opi
board_upload.flash_size = 16MB
build_flags =
  ${esp32_base.build_flags}
  -I variants/LilyGo_T5S3_EPaper_Pro
  -D LilyGo_T5S3_EPaper_Pro
  -D T5_S3_EPAPER_PRO_V2
  -D BOARD_HAS_PSRAM=1
  -D CORE_DEBUG_LEVEL=1
  -D FORMAT_SPIFFS_IF_FAILED=1
  -D FORMAT_LITTLEFS_IF_FAILED=1
  -D ARDUINO_USB_CDC_ON_BOOT=1
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D LORA_TX_POWER=22
  -D SX126X_DIO2_AS_RF_SWITCH
  -D SX126X_CURRENT_LIMIT=140
  -D SX126X_RX_BOOSTED_GAIN=1
  -D SX126X_DIO3_TCXO_VOLTAGE=2.4f
  -D P_LORA_DIO_1=10
  -D P_LORA_NSS=46
  -D P_LORA_RESET=1
  -D P_LORA_BUSY=47
  -D P_LORA_SCLK=14
  -D P_LORA_MISO=21
  -D P_LORA_MOSI=13
  -D ENV_INCLUDE_AHTX0=0
  -D ENV_INCLUDE_BME280=0
  -D ENV_INCLUDE_BMP280=0
  -D ENV_INCLUDE_SHTC3=0
  -D ENV_INCLUDE_SHT4X=0
  -D ENV_INCLUDE_LPS22HB=0
  -D ENV_INCLUDE_INA3221=0
  -D ENV_INCLUDE_INA219=0
  -D ENV_INCLUDE_INA226=0
  -D ENV_INCLUDE_INA260=0
  -D ENV_INCLUDE_MLX90614=0
  -D ENV_INCLUDE_VL53L0X=0
  -D ENV_INCLUDE_BME680=0
  -D ENV_INCLUDE_BMP085=0
  -D HAS_BQ27220=1
  -D AUTO_SHUTDOWN_MILLIVOLTS=2800
  -D PIN_USER_BTN=0
  -D SDCARD_USE_SPI1
  -D ARDUINO_LOOP_STACK_SIZE=32768
  -D HAS_MECK_FONTS
build_src_filter = ${esp32_base.build_src_filter}
  +<../variants/LilyGo_T5S3_EPaper_Pro>
lib_deps =
  ${esp32_base.lib_deps}
  WebServer
  DNSServer
  Update

; ---------------------------------------------------------------------------
; T5S3 standalone — touch UI (stub), verify display rendering
; Uses FastEPD for parallel e-ink, Adafruit GFX for drawing
; OTA enabled: WiFi AP activates only during user-initiated firmware updates.
; ---------------------------------------------------------------------------
[env:meck_t5s3_standalone]
extends = LilyGo_T5S3_EPaper_Pro
build_flags =
  ${LilyGo_T5S3_EPaper_Pro.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=2000
  -D MAX_GROUP_CHANNELS=20
  -D OFFLINE_QUEUE_SIZE=1
  -D CHANNEL_MSG_HISTORY_SIZE=800
  -D DISPLAY_CLASS=FastEPDDisplay
  -D USE_EINK
  -D MECK_CARDKB
  -D MECK_OTA_UPDATE=1
  ; -D MECK_SERIF_FONT  ; FreeSerif (Times New Roman-like)
  ;                      ; Default (no flag): FreeSans (Arial-like)
build_src_filter = ${LilyGo_T5S3_EPaper_Pro.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/FastEPDDisplay.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${LilyGo_T5S3_EPaper_Pro.lib_deps}
  densaugeo/base64 @ ~1.4.0
  adafruit/Adafruit GFX Library@^1.11.0
  https://github.com/mverch67/FastEPD/archive/0df1bff329b6fc782e062f611758880762340647.zip
  https://github.com/lewisxhe/SensorLib/archive/refs/tags/v0.3.4.zip

; ---------------------------------------------------------------------------
; T5S3 BLE companion — touch UI, BLE phone bridging
; Connect via MeshCore iOS/Android app over Bluetooth
; OTA enabled: WiFi AP activates only during user-initiated firmware updates.
; Flash: pio run -e meck_t5s3_ble -t upload
; ---------------------------------------------------------------------------
[env:meck_t5s3_ble]
extends = LilyGo_T5S3_EPaper_Pro
build_flags =
  ${LilyGo_T5S3_EPaper_Pro.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=2000
  -D MAX_GROUP_CHANNELS=20
  -D BLE_PIN_CODE=123456
  -D OFFLINE_QUEUE_SIZE=256
  -D DISPLAY_CLASS=FastEPDDisplay
  -D USE_EINK
  -D MECK_CARDKB
  -D MECK_OTA_UPDATE=1
  ; -D MECK_SERIF_FONT
build_src_filter = ${LilyGo_T5S3_EPaper_Pro.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/FastEPDDisplay.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${LilyGo_T5S3_EPaper_Pro.lib_deps}
  densaugeo/base64 @ ~1.4.0
  adafruit/Adafruit GFX Library@^1.11.0
  https://github.com/mverch67/FastEPD/archive/0df1bff329b6fc782e062f611758880762340647.zip
  https://github.com/lewisxhe/SensorLib/archive/refs/tags/v0.3.4.zip

; ---------------------------------------------------------------------------
; T5S3 WiFi companion — touch UI, WiFi phone bridging, web browser
; Connect via MeshCore web app or meshcore.js over local network (TCP:5000)
; MECK_WEB_READER: shares WiFi companion connection — no extra setup needed
; Flash: pio run -e meck_t5s3_wifi -t upload
; ---------------------------------------------------------------------------
[env:meck_t5s3_wifi]
extends = LilyGo_T5S3_EPaper_Pro
build_flags =
  ${LilyGo_T5S3_EPaper_Pro.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=2000
  -D MAX_GROUP_CHANNELS=20
  -D MECK_WIFI_COMPANION=1
  -D MECK_WEB_READER=1
  -D MECK_OTA_UPDATE=1
  -D TCP_PORT=5000
  -D OFFLINE_QUEUE_SIZE=256
  -D DISPLAY_CLASS=FastEPDDisplay
  -D USE_EINK
  -D MECK_CARDKB
  ; -D MECK_SERIF_FONT
build_src_filter = ${LilyGo_T5S3_EPaper_Pro.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/FastEPDDisplay.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${LilyGo_T5S3_EPaper_Pro.lib_deps}
  densaugeo/base64 @ ~1.4.0
  adafruit/Adafruit GFX Library@^1.11.0
  https://github.com/mverch67/FastEPD/archive/0df1bff329b6fc782e062f611758880762340647.zip
  https://github.com/lewisxhe/SensorLib/archive/refs/tags/v0.3.4.zip

  ; ---------------------------------------------------------------------------
; T5S3 WiFi Remote Repeater — WiFi MQTT backhaul, remote management
; Same MQTT protocol as T-Deck Pro remote repeater builds.
; Uses FastEPD for parallel e-ink display.
; Flash: pio run -e meck_wifi_repeater_t5s3 -t upload
; ---------------------------------------------------------------------------
[env:meck_wifi_repeater_t5s3]
extends = LilyGo_T5S3_EPaper_Pro
build_src_filter = ${LilyGo_T5S3_EPaper_Pro.build_src_filter}
  +<helpers/esp32/*.cpp>
  -<helpers/esp32/SerialBLEInterface.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/FastEPDDisplay.cpp>
  +<../examples/simple_repeater/*.cpp>
build_flags =
  ${LilyGo_T5S3_EPaper_Pro.build_flags}
  -D FIRMWARE_VERSION='"Meck T5S3 WiFi Rptr v0.1"'
  -D FIRMWARE_BUILD_DATE='"5 Apr 2026"'
  -D DISPLAY_CLASS=FastEPDDisplay
  -D USE_EINK
  -D MECK_WIFI_REMOTE
  -D MECK_REMOTE_REPEATER=1
  -D DISABLE_WIFI_OTA=1
  -D MAX_NEIGHBOURS=50
  -D HAS_SDCARD=1
  -D RADIOLIB_EXCLUDE_CC1101=1
  -D RADIOLIB_EXCLUDE_NRF24=1
  -D RADIOLIB_EXCLUDE_RF69=1
  -D RADIOLIB_EXCLUDE_SX1231=1
  -D RADIOLIB_EXCLUDE_SX1233=1
  -D RADIOLIB_EXCLUDE_SI443X=1
  -D RADIOLIB_EXCLUDE_RFM2X=1
  -D RADIOLIB_EXCLUDE_SX127X=1
  -D RADIOLIB_EXCLUDE_SX1272=1
  -D RADIOLIB_EXCLUDE_SX1278=1
  -D RADIOLIB_EXCLUDE_STM32WLX=1
  -D RADIOLIB_EXCLUDE_LR11X0=1
  -D RADIOLIB_EXCLUDE_LLCC68=1
  -D RADIOLIB_EXCLUDE_SX128X=1
  -D RADIOLIB_EXCLUDE_AFSK=1
  -D RADIOLIB_EXCLUDE_AX25=1
  -D RADIOLIB_EXCLUDE_HELLSCHREIBER=1
  -D RADIOLIB_EXCLUDE_MORSE=1
  -D RADIOLIB_EXCLUDE_RTTY=1
  -D RADIOLIB_EXCLUDE_SSTV=1
  -D RADIOLIB_EXCLUDE_APRS=1
  -D RADIOLIB_EXCLUDE_LORAWAN=1
  -D RADIOLIB_EXCLUDE_PAGER=1
  -D RADIOLIB_EXCLUDE_FSK4=1
  -D RADIOLIB_EXCLUDE_BELL=1
lib_deps =
  ${LilyGo_T5S3_EPaper_Pro.lib_deps}
  knolleary/PubSubClient@^2.8
  adafruit/Adafruit GFX Library@^1.11.0
  https://github.com/mverch67/FastEPD/archive/0df1bff329b6fc782e062f611758880762340647.zip
  https://github.com/lewisxhe/SensorLib/archive/refs/tags/v0.3.4.zip
lib_ignore =
  ESP32 BLE Arduino
  AsyncTCP
  RPAsyncTCP
  ESPAsyncWebServer
  AsyncElegantOTA
  ESP32-audioI2S
  esp32_codec2_arduino