; 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]
lib_dir = lib
include_dir = lib

[common_env_data]
upload_speed = 921600
monitor_speed =  115200
platform = espressif8266 @ 3.2.0
framework = arduino
board = d1_mini
build_unflags = 
build_flags = 
	-Wl,-Map,output.map
	-D BAUD=${common_env_data.monitor_speed}
	-D ACTIVATE_OTA	
	#-D DEBUG_ESP_HTTP_CLIENT	
	#-D DEBUG_ESP_HTTP_SERVER	
	#-D DEBUG_ESP_PORT=Serial			  	
	#-D DEBUG_ESP_WIFI
	#-D DEBUG_ESP_SSL
	#-D DEBUG_ESP_CORE
	#-D SKIP_SLEEPMODE
	-D USE_LITTLEFS=true
	-D EMBED_HTML			     				# If this is not used the html files needs to be on the file system (can be uploaded)
	-D USER_SSID=\""\""           # =\""myssid\""
	-D USER_SSID_PWD=\""\""       # =\""mypwd\""	
	-D CFG_APPVER="\"0.7.9\""
lib_deps = # Switched to forks for better version control.
	# Using local copy of these libraries
  #https://github.com/jrowberg/i2cdevlib.git#<document> 		
	#https://github.com/khoih-prog/ESP_WiFiManager#<document>
	#https://github.com/khoih-prog/ESP_DoubleResetDetector#<document>
	#https://github.com/PaulStoffregen/OneWire
	#https://github.com/milesburton/Arduino-Temperature-Control-Library
	https://github.com/mp-se/tinyexpr																		  #	https://github.com/codeplea/tinyexpr
	https://github.com/mp-se/incbin																			  #	https://github.com/graphitemaster/incbin
	https://github.com/mp-se/Arduino-Log#1.1.1    												# https://github.com/thijse/Arduino-Log
	https://github.com/mp-se/ArduinoJson#v6.18.5 											   	# https://github.com/bblanchon/ArduinoJson
	https://github.com/mp-se/arduinoCurveFitting#v1.0.6      							# https://github.com/Rotario/arduinoCurveFitting
	https://github.com/mp-se/arduino-mqtt#v2.5.0				    							# https://github.com/256dpi/arduino-mqtt

[env:gravity-debug]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
extra_scripts =  
	script/copy_html.py
	script/copy_firmware.py
	script/create_versionjson.py
build_unflags = 
	${common_env_data.build_unflags}
build_flags = 
  ${common_env_data.build_flags}
	#-D PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
	#-D SKIP_SLEEPMODE
	#-D DOUBLERESETDETECTOR_DEBUG=true
	-D COLLECT_PERFDATA	# This option will collect runtime data for a few defined methods to measure time, dumped to serial and/or influxdb 
	-D LOG_LEVEL=6 # Maximum log level for the debug build.
	-D CFG_DISABLE_LOGGING # Turn off verbose/notice logging to reduce size and dont overload uart. 
  -D GYRO_DISABLE_LOGGING
  -D CALC_DISABLE_LOGGING
  -D HELPER_DISABLE_LOGGING
  -D PUSH_DISABLE_LOGGING
  -D TSEN_DISABLE_LOGGING
  -D WIFI_DISABLE_LOGGING
  -D WEB_DISABLE_LOGGING
	-D MAIN_DISABLE_LOGGING
lib_deps = 
	${common_env_data.lib_deps}
board = ${common_env_data.board}
#build_type = debug
build_type = release
board_build.filesystem = littlefs
monitor_filters = esp8266_exception_decoder

[env:gravity-release]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
extra_scripts =  
	script/copy_html.py
	script/copy_firmware.py
	script/create_versionjson.py
build_unflags = ${common_env_data.build_unflags}
build_flags = 
    ${common_env_data.build_flags}
	-D LOG_LEVEL=4
lib_deps = 
	${common_env_data.lib_deps}
board = ${common_env_data.board}
build_type = release
board_build.filesystem = littlefs

[env:gravity-perf]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
extra_scripts =  
	script/copy_html.py
	script/copy_firmware.py
	script/create_versionjson.py
build_unflags = ${common_env_data.build_unflags}
build_flags = 
    ${common_env_data.build_flags}
	-D COLLECT_PERFDATA	
	-D LOG_LEVEL=5
lib_deps = 
	${common_env_data.lib_deps}
board = ${common_env_data.board}
build_type = release
board_build.filesystem = littlefs

[env:gravity32-perf]
framework = arduino
# platformio only supports v1.0.6 of the esp32 libs.
platform = espressif32
# tasmota port of v2.0.2 
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.1/platform-tasmota-espressif32-2.0.2.1.zip
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
extra_scripts =  
	script/copy_html.py
	script/copy_firmware.py
	script/create_versionjson.py
build_unflags = 
	${common_env_data.build_unflags}
build_flags = 
    ${common_env_data.build_flags}
	-D COLLECT_PERFDATA	
	-D LOG_LEVEL=5
lib_deps = 
	${common_env_data.lib_deps}
board = nodemcu-32s
build_type = release
#build_type = debug
#board_build.filesystem = littlefs 
board_build.filesystem = spiffs 
monitor_filters = esp32_exception_decoder