; 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]
extra_configs = 
	factory_settings.ini
	features.ini
default_envs = esp12e

[env]
build_flags = 
	${factory_settings.build_flags}
	${features.build_flags}
	-D NO_GLOBAL_ARDUINOOTA
	-D ENABLE_CORS
	-D CORS_ORIGIN=\"http://localhost:3000\"
	-D PROGMEM_WWW
lib_compat_mode = strict
framework = arduino
monitor_speed = 115200
extra_scripts = 
	pre:scripts/build_interface.py
lib_deps = 
	ArduinoJson@>=6.0.0,<7.0.0
	ESP Async WebServer@>=1.2.0,<2.0.0
	AsyncMqttClient@>=0.8.2,<1.0.0

[env:esp12e]
platform = espressif8266
board = esp12e
board_build.f_cpu = 160000000L
board_build.filesystem = littlefs
lib_deps = milesburton/DallasTemperature@^3.9.1

[env:node32s]
board_build.partitions = min_spiffs.csv
platform = espressif32
board = node32s
lib_deps = milesburton/DallasTemperature@^3.9.1

[factory_settings]
build_flags = 
	
	-D FACTORY_WIFI_SSID=\"\"
	-D FACTORY_WIFI_PASSWORD=\"\"
	-D FACTORY_WIFI_HOSTNAME=\"#{platform}-#{unique_id}\"
	
	-D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED
	-D FACTORY_AP_SSID=\"ESP8266-React-#{unique_id}\"
	-D FACTORY_AP_PASSWORD=\"esp-react\"
	-D FACTORY_AP_CHANNEL=1
	-D FACTORY_AP_SSID_HIDDEN=false
	-D FACTORY_AP_MAX_CLIENTS=4
	-D FACTORY_AP_LOCAL_IP=\"192.168.4.1\"
	-D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\"
	-D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\"
	
	-D FACTORY_ADMIN_USERNAME=\"admin\"
	-D FACTORY_ADMIN_PASSWORD=\"admin\"
	-D FACTORY_GUEST_USERNAME=\"guest\"
	-D FACTORY_GUEST_PASSWORD=\"guest\"
	
	-D FACTORY_NTP_ENABLED=true
	-D FACTORY_NTP_TIME_ZONE_LABEL=\"Europe/Brussels\"
	-D FACTORY_NTP_TIME_ZONE_FORMAT=\"GMT0BST,M3.5.0/1,M10.5.0\"
	-D FACTORY_NTP_SERVER=\"time.google.com\"
	
	-D FACTORY_OTA_PORT=8266
	-D FACTORY_OTA_PASSWORD=\"esp-react\"
	-D FACTORY_OTA_ENABLED=true
	
	-D FACTORY_MQTT_ENABLED=false
	-D FACTORY_MQTT_HOST=\"test.mosquitto.org\"
	-D FACTORY_MQTT_PORT=1883
	-D FACTORY_MQTT_USERNAME=\"\"
	-D FACTORY_MQTT_PASSWORD=\"\"
	-D FACTORY_MQTT_CLIENT_ID=\"#{platform}-#{unique_id}\"
	-D FACTORY_MQTT_KEEP_ALIVE=60
	-D FACTORY_MQTT_CLEAN_SESSION=true
	-D FACTORY_MQTT_MAX_TOPIC_LENGTH=128
	
	-D FACTORY_JWT_SECRET=\"#{random}-#{random}\"

[features]
build_flags = 
	-D FT_PROJECT=1
	-D FT_SECURITY=1
	-D FT_MQTT=1
	-D FT_NTP=1
	-D FT_OTA=1
	-D FT_UPLOAD_FIRMWARE=1
