; PlatformIO Project Configuration File
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = tbeam

extra_configs =
	arch/*/*.ini
	variants/*/platformio.ini
	src/graphics/niche/InkHUD/PlatformioConfig.ini

description = Meshtastic

[env]
test_build_src = true
extra_scripts = bin/platformio-custom.py
; note: we add src to our include search path so that lmic_project_config can override
; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important.  We don't use custom fields and somewhere in that pile
; of code is a heap corruption bug!
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need.
build_flags = -Wno-missing-field-initializers

	-Wno-format
	-Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,"${platformio.build_dir}"/output.map
	-DUSE_THREAD_NAMES
	-DTINYGPS_OPTION_NO_CUSTOM_FIELDS
	-DPB_ENABLE_MALLOC=1
	-DRADIOLIB_EXCLUDE_CC1101=1
	-DRADIOLIB_EXCLUDE_NRF24=1
	-DRADIOLIB_EXCLUDE_RF69=1
	-DRADIOLIB_EXCLUDE_SX1231=1
	-DRADIOLIB_EXCLUDE_SX1233=1
	-DRADIOLIB_EXCLUDE_SI443X=1
	-DRADIOLIB_EXCLUDE_RFM2X=1
	-DRADIOLIB_EXCLUDE_AFSK=1
	-DRADIOLIB_EXCLUDE_BELL=1
	-DRADIOLIB_EXCLUDE_HELLSCHREIBER=1
	-DRADIOLIB_EXCLUDE_MORSE=1
	-DRADIOLIB_EXCLUDE_RTTY=1
	-DRADIOLIB_EXCLUDE_SSTV=1
	-DRADIOLIB_EXCLUDE_AX25=1
	-DRADIOLIB_EXCLUDE_DIRECT_RECEIVE=1
	-DRADIOLIB_EXCLUDE_BELL=1
	-DRADIOLIB_EXCLUDE_PAGER=1
	-DRADIOLIB_EXCLUDE_FSK4=1
	-DRADIOLIB_EXCLUDE_APRS=1
	-DRADIOLIB_EXCLUDE_LORAWAN=1
	-DMESHTASTIC_EXCLUDE_DROPZONE=1
	-DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1
	-DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1
	-DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware
	-DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1
	-D MAX_THREADS=40 ; As we've split modules, we have more threads to manage
	#-DBUILD_EPOCH=$UNIX_TIME
	#-D OLED_PL=1

monitor_speed = 115200
monitor_filters = direct
lib_deps =
	# renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master
	https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip
	# renovate: datasource=custom.pio depName=OneButton packageName=mathertel/library/OneButton
	mathertel/OneButton@2.6.1
	# renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master
	https://github.com/meshtastic/arduino-fsm/archive/7db3702bf0cfe97b783d6c72595e3f38e0b19159.zip
	# renovate: datasource=git-refs depName=meshtastic-TinyGPSPlus packageName=https://github.com/meshtastic/TinyGPSPlus gitBranch=master
	https://github.com/meshtastic/TinyGPSPlus/archive/71a82db35f3b973440044c476d4bcdc673b104f4.zip
	# renovate: datasource=git-refs depName=meshtastic-ArduinoThread packageName=https://github.com/meshtastic/ArduinoThread gitBranch=master
	https://github.com/meshtastic/ArduinoThread/archive/7c3ee9e1951551b949763b1f5280f8db1fa4068d.zip
	# renovate: datasource=custom.pio depName=Nanopb packageName=nanopb/library/Nanopb
	nanopb/Nanopb@0.4.91
	# renovate: datasource=custom.pio depName=ErriezCRC32 packageName=erriez/library/ErriezCRC32
	erriez/ErriezCRC32@1.0.1

; Used for the code analysis in PIO Home / Inspect
check_tool = cppcheck
check_skip_packages = yes
check_flags =
	-DAPP_VERSION=1.0.0
	--suppressions-list=suppressions.txt
	--inline-suppr

; Common settings for conventional (non Portduino) Arduino targets
[arduino_base]
framework = arduino
lib_deps =
	${env.lib_deps}
	# renovate: datasource=custom.pio depName=NonBlockingRTTTL packageName=end2endzone/library/NonBlockingRTTTL
	end2endzone/NonBlockingRTTTL@1.3.0
build_flags = ${env.build_flags} -Os
build_src_filter = ${env.build_src_filter} -<platform/portduino/> -<graphics/niche/>

; Common libs for communicating over TCP/IP networks such as MQTT
[networking_base]
lib_deps =
	# renovate: datasource=custom.pio depName=TBPubSubClient packageName=thingsboard/library/TBPubSubClient
	thingsboard/TBPubSubClient@2.12.1
	# renovate: datasource=custom.pio depName=NTPClient packageName=arduino-libraries/library/NTPClient
	arduino-libraries/NTPClient@3.2.1
	# renovate: datasource=custom.pio depName=Syslog packageName=arcao/library/Syslog
	arcao/Syslog@2.0.0

[radiolib_base]
lib_deps =
	# renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib
	jgromes/RadioLib@7.2.0

[device-ui_base]
lib_deps =
	# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
	https://github.com/meshtastic/device-ui/archive/4b7bf369adfa5a7bd419fa8293d21206576d52d0.zip

; Common libs for environmental measurements in telemetry module
[environmental_base]
lib_deps =
	# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
	adafruit/Adafruit BusIO@1.17.1
	# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
	adafruit/Adafruit Unified Sensor@1.1.15
	# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
	adafruit/Adafruit BMP280 Library@2.6.8
	# renovate: datasource=custom.pio depName=Adafruit BMP085 packageName=adafruit/library/Adafruit BMP085 Library
	adafruit/Adafruit BMP085 Library@1.2.4
	# renovate: datasource=custom.pio depName=Adafruit BME280 packageName=adafruit/library/Adafruit BME280 Library
	adafruit/Adafruit BME280 Library@2.3.0
	# renovate: datasource=custom.pio depName=Adafruit DPS310 packageName=adafruit/library/Adafruit DPS310
	adafruit/Adafruit DPS310@1.1.5
	# renovate: datasource=custom.pio depName=Adafruit MCP9808 packageName=adafruit/library/Adafruit MCP9808 Library
	adafruit/Adafruit MCP9808 Library@2.0.2
	# renovate: datasource=custom.pio depName=Adafruit INA260 packageName=adafruit/library/Adafruit INA260 Library
	adafruit/Adafruit INA260 Library@1.5.2
	# renovate: datasource=custom.pio depName=Adafruit INA219 packageName=adafruit/library/Adafruit INA219
	adafruit/Adafruit INA219@1.2.3
	# renovate: datasource=custom.pio depName=Adafruit PM25 AQI Sensor packageName=adafruit/library/Adafruit PM25 AQI Sensor
	adafruit/Adafruit PM25 AQI Sensor@2.0.0
	# renovate: datasource=custom.pio depName=Adafruit MPU6050 packageName=adafruit/library/Adafruit MPU6050
	adafruit/Adafruit MPU6050@2.2.6
	# renovate: datasource=custom.pio depName=Adafruit LIS3DH packageName=adafruit/library/Adafruit LIS3DH
	adafruit/Adafruit LIS3DH@1.3.0
	# renovate: datasource=custom.pio depName=Adafruit AHTX0 packageName=adafruit/library/Adafruit AHTX0
	adafruit/Adafruit AHTX0@2.0.5
	# renovate: datasource=custom.pio depName=Adafruit LSM6DS packageName=adafruit/library/Adafruit LSM6DS
	adafruit/Adafruit LSM6DS@4.7.4
	# renovate: datasource=custom.pio depName=Adafruit TSL2591 packageName=adafruit/library/Adafruit TSL2591 Library
	adafruit/Adafruit TSL2591 Library@1.4.5
	# renovate: datasource=custom.pio depName=EmotiBit MLX90632 packageName=emotibit/library/EmotiBit MLX90632
	emotibit/EmotiBit MLX90632@1.0.8
	# renovate: datasource=custom.pio depName=Adafruit MLX90614 packageName=adafruit/library/Adafruit MLX90614 Library
	adafruit/Adafruit MLX90614 Library@2.1.5
	# renovate: datasource=github-tags depName=INA3221 packageName=KodinLanewave/INA3221
	https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip
	# renovate: datasource=custom.pio depName=QMC5883L Compass packageName=mprograms/library/QMC5883LCompass
	mprograms/QMC5883LCompass@1.2.3
	# renovate: datasource=custom.pio depName=DFRobot_RTU packageName=dfrobot/library/DFRobot_RTU
	dfrobot/DFRobot_RTU@1.0.3
	# renovate: datasource=git-refs depName=DFRobot_RainfallSensor packageName=https://github.com/DFRobot/DFRobot_RainfallSensor gitBranch=master
	https://github.com/DFRobot/DFRobot_RainfallSensor/archive/38fea5e02b40a5430be6dab39a99a6f6347d667e.zip
	# renovate: datasource=custom.pio depName=INA226 packageName=robtillaart/library/INA226
	robtillaart/INA226@0.6.4
	# renovate: datasource=custom.pio depName=SparkFun MAX3010x packageName=sparkfun/library/SparkFun MAX3010x Pulse and Proximity Sensor Library
	sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
	# renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
	sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2
	# renovate: datasource=custom.pio depName=Adafruit LTR390 Library packageName=adafruit/library/Adafruit LTR390 Library
	adafruit/Adafruit LTR390 Library@1.1.2
	# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/library/Adafruit PCT2075
	adafruit/Adafruit PCT2075@1.0.5
	# renovate: datasource=custom.pio depName=DFRobot_BMM150 packageName=dfrobot/library/DFRobot_BMM150
	dfrobot/DFRobot_BMM150@1.0.0

; (not included in native / portduino)
[environmental_extra]
lib_deps =
	# renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library
	adafruit/Adafruit BMP3XX Library@2.1.6
	# renovate: datasource=custom.pio depName=Adafruit MAX1704X packageName=adafruit/library/Adafruit MAX1704X
	adafruit/Adafruit MAX1704X@1.0.3
	# renovate: datasource=custom.pio depName=Adafruit SHTC3 packageName=adafruit/library/Adafruit SHTC3 Library
	adafruit/Adafruit SHTC3 Library@1.0.1
	# renovate: datasource=custom.pio depName=Adafruit LPS2X packageName=adafruit/library/Adafruit LPS2X
	adafruit/Adafruit LPS2X@2.0.6
	# renovate: datasource=custom.pio depName=Adafruit SHT31 packageName=adafruit/library/Adafruit SHT31 Library
	adafruit/Adafruit SHT31 Library@2.2.2
	# renovate: datasource=custom.pio depName=Adafruit VEML7700 packageName=adafruit/library/Adafruit VEML7700 Library
	adafruit/Adafruit VEML7700 Library@2.1.6
	# renovate: datasource=custom.pio depName=Adafruit SHT4x packageName=adafruit/library/Adafruit SHT4x Library
	adafruit/Adafruit SHT4x Library@1.0.5
	# renovate: datasource=custom.pio depName=SparkFun Qwiic Scale NAU7802 packageName=sparkfun/library/SparkFun Qwiic Scale NAU7802 Arduino Library
	sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6
	# renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001
	ClosedCube OPT3001@1.1.2
	# renovate: datasource=custom.pio depName=Bosch BSEC2 packageName=boschsensortec/library/bsec2
	boschsensortec/bsec2@1.10.2610
	# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
	boschsensortec/BME68x Sensor Library@1.3.40408
	# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
	https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
	# renovate: datasource=custom.pio depName=Sensirion Core packageName=sensirion/library/Sensirion Core
	sensirion/Sensirion Core@0.7.1
	# renovate: datasource=custom.pio depName=Sensirion I2C SCD4x packageName=sensirion/library/Sensirion I2C SCD4x
	sensirion/Sensirion I2C SCD4x@1.1.0
