; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = generic
extra_configs =
    platformio_override.ini

[env]
framework = arduino
platform = espressif32@>=6.0.1

build_flags =
    -DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/js/app.js.gz
    -Wall -Wextra -Werror

lib_deps =
    https://github.com/yubox-node-org/ESPAsyncWebServer
    bblanchon/ArduinoJson @ ^6.20.1
    https://github.com/bertmelis/espMqttClient.git#v1.3.3
    nrf24/RF24 @ ^1.4.5
    olikraus/U8g2 @ ^2.34.13
    buelowp/sunset @ ^1.1.7
    https://github.com/coryjfowler/MCP_CAN_lib

extra_scripts =
    pre:auto_firmware_version.py

board_build.partitions = partitions_custom.csv
board_build.filesystem = littlefs
monitor_filters = esp32_exception_decoder, time, log2file, colorize
monitor_speed = 115200
upload_protocol = esptool

; Specify port in platformio_override.ini. Comment out (add ; in front of line) to use auto detection.
; monitor_port = COM4
; upload_port = COM4


[env:generic]
board = esp32dev
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=19
    -DHOYMILES_PIN_MOSI=23
    -DHOYMILES_PIN_SCLK=18
    -DHOYMILES_PIN_IRQ=16
    -DHOYMILES_PIN_CE=4
    -DHOYMILES_PIN_CS=5
    -DVICTRON_PIN_TX=21
	-DVICTRON_PIN_RX=22
    -DPYLONTECH_PIN_RX=27
    -DPYLONTECH_PIN_TX=14
    -DHUAWEI_PIN_MISO=12
    -DHUAWEI_PIN_MOSI=13
    -DHUAWEI_PIN_SCLK=26
    -DHUAWEI_PIN_IRQ=25
    -DHUAWEI_PIN_CS=15


[env:olimex_esp32_poe]
; https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware
board = esp32-poe
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=15
    -DHOYMILES_PIN_MOSI=2
    -DHOYMILES_PIN_SCLK=14
    -DHOYMILES_PIN_IRQ=13
    -DHOYMILES_PIN_CE=16
    -DHOYMILES_PIN_CS=5
    -DOPENDTU_ETHERNET


[env:olimex_esp32_evb]
; https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware
board = esp32-evb
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=15
    -DHOYMILES_PIN_MOSI=2
    -DHOYMILES_PIN_SCLK=14
    -DHOYMILES_PIN_IRQ=13
    -DHOYMILES_PIN_CE=16
    -DHOYMILES_PIN_CS=17
    -DOPENDTU_ETHERNET


[env:d1 mini esp32]
board = wemos_d1_mini32
build_flags = 
	${env.build_flags}
	-DHOYMILES_PIN_MISO=19
	-DHOYMILES_PIN_MOSI=23
	-DHOYMILES_PIN_SCLK=18
	-DHOYMILES_PIN_IRQ=16
	-DHOYMILES_PIN_CE=17
	-DHOYMILES_PIN_CS=5
	-DVICTRON_PIN_TX=21
	-DVICTRON_PIN_RX=22
    -DPYLONTECH_PIN_RX=27
    -DPYLONTECH_PIN_TX=14

[env:wt32_eth01]
; http://www.wireless-tag.com/portfolio/wt32-eth01/
board = wt32-eth01
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=4
    -DHOYMILES_PIN_MOSI=2
    -DHOYMILES_PIN_SCLK=32
    -DHOYMILES_PIN_IRQ=33
    -DHOYMILES_PIN_CE=14
    -DHOYMILES_PIN_CS=15
    -DOPENDTU_ETHERNET


[env:LilyGO_T_ETH_POE]
; http://www.lilygo.cn/claprod_view.aspx?TypeId=21&Id=1344&FId=t28:21:28
board = esp32dev
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=2
    -DHOYMILES_PIN_MOSI=15
    -DHOYMILES_PIN_SCLK=14
    -DHOYMILES_PIN_IRQ=34
    -DHOYMILES_PIN_CE=12
    -DHOYMILES_PIN_CS=4
    -DOPENDTU_ETHERNET
    -DETH_CLK_MODE=ETH_CLOCK_GPIO17_OUT
    -DETH_POWER_PIN=-1
    -DETH_TYPE=ETH_PHY_LAN8720
    -DETH_ADDR=0
    -DETH_MDC_PIN=23
    -DETH_MDIO_PIN=18


[env:esp_s3_12k_kit]
; https://www.waveshare.com/wiki/NodeMCU-ESP-S3-12K-Kit
board = esp32-s3-devkitc-1
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=16
    -DHOYMILES_PIN_MOSI=17
    -DHOYMILES_PIN_SCLK=18
    -DHOYMILES_PIN_IRQ=3
    -DHOYMILES_PIN_CE=4
    -DHOYMILES_PIN_CS=5


[env:lolin32_lite]
; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/
; https://www.az-delivery.de/products/esp32-lolin-lolin32
board = lolin32_lite
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=19
    -DHOYMILES_PIN_MOSI=23
    -DHOYMILES_PIN_SCLK=18
    -DHOYMILES_PIN_IRQ=16
    -DHOYMILES_PIN_CE=17
    -DHOYMILES_PIN_CS=5

[env:lolin_s2_mini]
board = lolin_s2_mini
build_flags = ${env.build_flags}
    -DHOYMILES_PIN_MISO=13
    -DHOYMILES_PIN_MOSI=11
    -DHOYMILES_PIN_SCLK=12
    -DHOYMILES_PIN_CS=10
    -DHOYMILES_PIN_IRQ=4
    -DHOYMILES_PIN_CE=5