[platformio]
name = JSY Remote UDP Sender
default_envs = denky_d4, esp32-c3-devkitc-02, esp32-c6-devkitc-1, esp32_gateway_rev_e, esp32_gateway_rev_f, esp32-poe-iso, esp32-poe, esp32-s2-saola-1, esp32-s3-devkitc-1, esp32dev, esp32s3box, lilygo_eth_lite_s3, nodemcu-32s, tinypico, wipy3, wt32-eth01

[env]
build_type = release
; build_type = debug

framework = arduino
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-1/platform-espressif32.zip

monitor_filters = esp32_exception_decoder, log2file
monitor_speed = 115200

upload_protocol = esptool
upload_speed = 921600
; upload_speed = 460800
; upload_speed = 115200

lib_compat_mode = strict
lib_ldf_mode = chain
lib_deps = 
  AsyncUDP
  DNSServer
  ESPmDNS
  FS
  Networking
  LittleFS
  WiFi
  Ticker
  Update
  robtillaart/CRC @ 1.0.3
  bblanchon/ArduinoJson @ 7.4.2
  ESP32Async/AsyncTCP @ 3.4.7
  ESP32Async/ESPAsyncWebServer @ 3.7.10
  mathieucarbou/MycilaESPConnect @ 10.2.3
  mathieucarbou/MycilaLogger @ 3.3.0
  mathieucarbou/MycilaSystem @ 4.1.0
  mathieucarbou/MycilaTaskManager @ 4.0.1
  mathieucarbou/MycilaTaskMonitor @ 4.0.0
  mathieucarbou/MycilaUtilities @ 3.3.0
  mathieucarbou/MycilaWebSerial @ 8.1.1
  ayushsharma82/ElegantOTA @ 3.1.7
  ayushsharma82/ESP-DASH @ 5.0.0
  MycilaJSY=file://../../..

build_flags =
  -D CONFIG_ASYNC_TCP_MAX_ACK_TIME=5000
  -D CONFIG_ASYNC_TCP_PRIORITY=10
  -D CONFIG_ASYNC_TCP_QUEUE_SIZE=64
  -D CONFIG_ASYNC_TCP_RUNNING_CORE=1
  -D CONFIG_ASYNC_TCP_STACK_SIZE=4096
  -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1
  ; ESP-DASH with STL string
  -D DASH_USE_STL_STRING=1
  -D MYCILA_JSON_SUPPORT
  -D MYCILA_LOGGER_SUPPORT
  -D WS_MAX_QUEUED_MESSAGES=64
  -D WSL_HIGH_PERF
  -Wall -Wextra
  -std=c++17
  -std=gnu++17
  -O3
  ; -Os
  ; -Og
  ; -ggdb -ggdb3 -g3
  ; -D CONFIG_ARDUHAL_LOG_COLORS
  -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
build_unflags =
    -std=gnu++11

board_build.partitions = tools/partitions-4MB-hex.csv
board_build.app_partition_name = app0
board_upload.offset_address = 0x10000
board_build.filesystem = littlefs

extra_scripts =
    post:tools/factory.py

[env:dev]
; board = esp32dev
; board = esp32-c3-devkitc-02
; board = esp32-c6-devkitc-1
; board = esp32-poe
; board = esp32-s2-saola-1
; board = esp32-s3-devkitc-1
; board = esp32s3box
; board = nodemcu-32s
board = wt32-eth01

;  CI

[env:ci]
board = ${sysenv.PIO_BOARD}

[env:denky_d4]
board = denky_d4
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=22
  -D MYCILA_JSY_TX=21

[env:esp32-c3-devkitc-02]
board = esp32-c3-devkitc-02
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=18
  -D MYCILA_JSY_TX=19

[env:esp32-c6-devkitc-1]
board = esp32-c6-devkitc-1
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=4
  -D MYCILA_JSY_TX=5

[env:esp32_gateway_rev_e]
board = esp32-gateway
board_build.extra_flags = "-DARDUINO_ESP32_GATEWAY_E"
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_RESET_ON_START
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=16
  -D MYCILA_JSY_TX=17

[env:esp32_gateway_rev_f]
board = esp32-gateway
board_build.extra_flags = "-DARDUINO_ESP32_GATEWAY_F"
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_RESET_ON_START
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=16
  -D MYCILA_JSY_TX=17

[env:esp32-poe-iso]
board = esp32-poe-iso
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_RESET_ON_START
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=35
  -D MYCILA_JSY_TX=33

[env:esp32-poe]
board = esp32-poe
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_RESET_ON_START
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=35
  -D MYCILA_JSY_TX=33

[env:esp32-s2-saola-1]
board = esp32-s2-saola-1
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial1
  -D MYCILA_JSY_RX=18
  -D MYCILA_JSY_TX=17

[env:esp32-s3-devkitc-1]
board = esp32-s3-devkitc-1
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=16
  -D MYCILA_JSY_TX=17

[env:esp32dev]
board = esp32dev
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=16
  -D MYCILA_JSY_TX=17

[env:esp32s3box]
board = esp32s3box
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=19
  -D MYCILA_JSY_TX=20

[env:lilygo_eth_lite_s3]
board = esp32s3box
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=4
  -D MYCILA_JSY_TX=5

[env:nodemcu-32s]
board = nodemcu-32s
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=16
  -D MYCILA_JSY_TX=17

[env:tinypico]
board = tinypico
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=4
  -D MYCILA_JSY_TX=25

[env:wipy3]
board = wipy3
build_flags = ${env.build_flags}
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=4
  -D MYCILA_JSY_TX=25

[env:wt32-eth01]
upload_speed = 460800
board = wt32-eth01
build_flags = ${env.build_flags}
  -D ESPCONNECT_ETH_RESET_ON_START
  -D ESPCONNECT_ETH_SUPPORT
  -D MYCILA_JSY_SERIAL=Serial2
  -D MYCILA_JSY_RX=5
  -D MYCILA_JSY_TX=17
