; example custom platformio.ini file for EMS-ESP

[common]
; custom build flags:
;  -DEMSESP_WIFI_TWEAK ; experimental WiFi tweaks for stability
;  -DEMSESP_UART_DEBUG ; debugging UART
;  -DEMSESP_DEBUG ; enables DEBUG to the log. Will generate a lot of extra traffic on Console and Syslog
;  -DEMSESP_DEFAULT_BOARD_PROFILE=\"NODEMCU\" ; hard code the default board name
;  -DEMSESP_DEBUG_SENSOR ; additional debug for the sensors
;  -DCORE_DEBUG_LEVEL=5 ; verbose core level debugging 5=verbose, 4=debug, 3=info
;  -DEMSESP_TEST ; enable the tests. EN language only
;  -DEMSESP_DE_ONLY ; only DE translated entity names
;  -DEMSESP_EN_ONLY ; only EN translated entity names
; my_build_flags = -DEMSESP_DEBUG

[platformio]
default_envs = esp32_4M
; default_envs = esp32_16M
; default_envs = lolin_s3
; default_envs = standalone
; default_envs =  debug

[env:esp32_4M]
; update to arduino 3, IDF 5
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
;
; if using OTA enter your details below
;  upload_protocol = espota
;  upload_flags =
;    --port=8266
;    --auth=ems-esp-neo
;  upload_port = ems-esp.local
; for USB use
upload_port = /dev/ttyUSB*
; upload_port = COM5

; override arduino espressif core
platform = espressif32 ; take latest
; platform = espressif32@5.3.0
; platform = espressif32@6.3.2
; platform = espressif32@6.4.0

extra_scripts =
  pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
  scripts/rename_fw.py
  ; post:scripts/app-tls-size.py

[env:esp32_16M]

[env:lolin_s3]
upload_port = /dev/ttyACM0
extra_scripts =
  pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
  scripts/rename_fw.py

; pio run -e debug
; or from Visual Studio Code do PIO -> Project Tasks -> debug -> General -> Upload and Monitor
; options for debugging are: EMSESP_DEBUG EMSESP_UART_DEBUG EMSESP_DEBUG_SENSOR
[env:debug]
board = esp32dev
framework = arduino
platform = espressif32
board_build.partitions = esp32_partition_debug.csv
; board_build.partitions = esp32_partition_4M.csv
board_upload.flash_size = 4MB
board_build.filesystem = littlefs
upload_protocol = esptool
build_type = debug
monitor_raw = no
monitor_filters = esp32_exception_decoder
debug_tool = esp-prog
debug_init_break = tbreak setup
build_flags = ${factory_settings.build_flags} -DEMSESP_EN_ONLY -DCORE_DEBUG_LEVEL=5 -DONEWIRE_CRC16=0 -DNO_GLOBAL_ARDUINOOTA -DARDUINOJSON_ENABLE_STD_STRING=1 -DESP32=1 -DARDUINO_ARCH_ESP32=1
upload_port = /dev/ttyUSB0
extra_scripts =
  ; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
  scripts/rename_fw.py
  ; post:scripts/app-tls-size.py
