refactor platformio ini file

transfer macro definition to platformio ini instead of test_config.h
This commit is contained in:
1technophile committed 2019-08-04 10:56:07 +02:00
1 parent 0a9e8eaf35
commit 9bf09955b8
2 files changed
+334 -173

No files matched your search

+332 -66
View File
@@ -10,87 +10,353 @@
[platformio]
src_dir = main
default_envs = nodemcuv2, esp32dev, uno, atmega
;, uno, atmega, esp32dev, nodemcuv2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENVIRONMENT CHOICE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Uncomment the env line corresponding to your board and modules required, ;
;you can also adapt the modules by removing the corresponding lines in the env detail ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[common]
;default_envs = rfbridge
;default_envs = esp32dev-all
;default_envs = esp32dev-rf
;default_envs = esp32dev-ir
;default_envs = esp32dev-ble
;default_envs = ttgo-lora32-v1
;default_envs = nodemcuv2-rf
;default_envs = nodemcuv2-ir
;default_envs = nodemcuv2-ble
;default_envs = nodemcuv2-all
;default_envs = uno-rf
;default_envs = uno-fastled
;default_envs = atmega-all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENVIRONMENTS PARAMETERS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Libraries and parameters shared accross environements ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[libraries]
arduinojson = ArduinoJson@5.13.4
pubsubclient = PubSubClient@2.7
rc-switch = 1technophile/rc-switch#90adb34
newremoteswitch = 1technophile/NewRemoteSwitch#8eb980e
ble = eos1d3/ESP32_BLE#9d6c1ed
irremoteesp = IRremoteESP8266@2.6.3
irremote = IRremote
lora = sandeepmistry/arduino-LoRa#f4a1d27
esppilight = ESPiLight@0.16.0
rfm69 = RFM69@4a6f77ad47
dht = DHT sensor library@1.3.0
unifiedsensor = Adafruit Unified Sensor@1.0.2
tsl2561 = Adafruit TSL2561@1.0.3
bme280 = SparkFun BME280@2.0.4
bmp180 = BMP180@efac46bd8d
ina226 = jarzebski/Arduino-INA226#968a684
a6lib = 1technophile/A6lib
wifimanager = tzapu/WiFiManager#c3ff582
ethernet = Ethernet
esp8266_mdns = esp8266_mdns
wire = Wire
fastled = FastLED
[env]
framework = arduino
lib_deps =
Adafruit Unified Sensor
1technophile/PubSubClient
SparkFun BME280
BMP180
RFM69
ArduinoJson@5.13.4
DHT sensor library
Adafruit TSL2561
1technophile/rc-switch
Wire
jarzebski/Arduino-INA226
1technophile/NewRemoteSwitch
FastLED
${libraries.pubsubclient}
${libraries.arduinojson}
build_flags =
-w ; supress all warnings
[env:nodemcuv2]
framework = ${common.framework}
platform = espressif8266
board = nodemcuv2
lib_deps =
${common.lib_deps}
1technophile/A6lib
ESPiLight
IRremoteESP8266
https://github.com/tzapu/WiFiManager.git#c3ff582374e677f76d14de013966df0888b5b38e
esp8266_mdns
FastLED
lib_ignore =
Ethernet
build_flags =
${common.build_flags}
'-DjsonPublishing=true'
'-DjsonReceiving=true'
monitor_speed = 115200
board_build.flash_mode = dout
upload_speed = 115200
upload_resetmethod = nodemcu
[env:esp32dev]
framework = ${common.framework}
platform = espressif32
[com]
esp8266_platform = espressif8266@1.8.0 ; 2.4.2
esp32_platform = espressif32@1.9.0
atmelavr_platform = atmelavr@1.13.0
[com-esp]
lib_deps =
${env.lib_deps}
${libraries.wifimanager}
build_flags =
${env.build_flags}
-DMQTT_MAX_PACKET_SIZE=1024
'-DsimpleReceiving=true'
'-DsimplePublishing=true'
'-DZmqttDiscovery="HADiscovery"'
'-DTRACE=1'
[com-arduino]
lib_deps =
${env.lib_deps}
${libraries.ethernet}
build_flags =
${env.build_flags}
-DMQTT_MAX_PACKET_SIZE=1024
'-DsimpleReceiving=true'
'-DsimplePublishing=true'
'-DZmqttDiscovery="HADiscovery"'
'-DTRACE=1'
[com-arduino-low-memory]
lib_deps =
${env.lib_deps}
${libraries.ethernet}
build_flags =
${env.build_flags}
-DMQTT_MAX_PACKET_SIZE=128
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENVIRONMENTS LIST ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;List of environments that can be build ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[env:rfbridge]
platform = ${com.esp8266_platform}
board = esp8285
lib_deps =
${com-esp.lib_deps}
${libraries.esp8266_mdns}
build_flags =
${com-esp.build_flags}
'-DZgatewaySRFB="SRFB"'
'-DGateway_Name="OpenMQTTGateway_SRFB"'
board_build.flash_mode = dout
[env:esp32dev-all]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${common.lib_deps}
IRremoteESP8266
https://github.com/tzapu/WiFiManager.git#c3ff582374e677f76d14de013966df0888b5b38e
https://github.com/eos1d3/ESP32_BLE.git
https://github.com/sandeepmistry/arduino-LoRa.git
FastLED
lib_ignore =
esp8266_mdns
Ethernet
build_flags =
${common.build_flags}
${com-esp.lib_deps}
${libraries.ble}
${libraries.irremoteesp}
${libraries.lora}
${libraries.rfm69}
${libraries.rc-switch}
${libraries.newremoteswitch}
${libraries.bme280}
${libraries.bmp180}
${libraries.unifiedsensor}
${libraries.dht}
${libraries.tsl2561}
${libraries.ina226}
${libraries.fastled}
build_flags =
${com-esp.build_flags}
'-DZgatewayRF="RF"'
'-DZgatewayLORA="LORA"'
'-DZgatewayRF2="RF2"'
'-DZgatewayIR="IR"'
'-DZgatewayBT="BT"'
'-DZactuatorONOFF="ONOFF"'
'-DZactuatorFASTLED="FASTLED"'
'-DZsensorINA226="INA226"'
'-DZsensorHCSR501="HCSR501"'
'-DZsensorADC="ADC"'
'-DZsensorBH1750="BH1750"'
'-DZsensorBME280="BME280"'
'-DZsensorTSL2561="TSL2561"'
'-DZsensorDHT="DHT"'
'-DZgatewayRFM69="RFM69"'
'-DZsensorGPIOInput="GPIOInput"'
'-DZsensorGPIOKeyCode="GPIOKeyCode"'
'-DGateway_Name="OpenMQTTGateway_ESP32_ALL"'
[env:atmega]
framework = ${common.framework}
platform = atmelavr
[env:esp32dev-rf]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.rc-switch}
build_flags =
${com-esp.build_flags}
'-DZgatewayRF="RF"'
'-DGateway_Name="OpenMQTTGateway_ESP32_RF"'
[env:esp32dev-ir]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.irremoteesp}
build_flags =
${com-esp.build_flags}
'-DZgatewayIR="IR"'
'-DGateway_Name="OpenMQTTGateway_ESP32_IR"'
[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.ble}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
[env:ttgo-lora32-v1]
platform = ${com.esp32_platform}
board = ttgo-lora32-v1
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.lora}
build_flags =
${com-esp.build_flags}
'-DZgatewayLORA="LORA"'
'-DGateway_Name="OpenMQTTGateway_ESP32_LORA"'
[env:nodemcuv2-all]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
${com-esp.lib_deps}
${libraries.esppilight}
${libraries.irremoteesp}
${libraries.rfm69}
${libraries.rc-switch}
${libraries.a6lib}
${libraries.newremoteswitch}
${libraries.bme280}
${libraries.bmp180}
${libraries.unifiedsensor}
${libraries.dht}
${libraries.tsl2561}
${libraries.ina226}
${libraries.esp8266_mdns}
${libraries.wire}
${libraries.fastled}
build_flags =
${com-esp.build_flags}
'-DZgatewayRF="RF"'
'-DZgatewayRF2="RF2"'
'-DZgatewayIR="IR"'
'-DZgatewayBT="BT"'
'-DZgateway2G="2G"'
'-DZgatewayPilight="Pilight"'
'-DZactuatorONOFF="ONOFF"'
'-DZactuatorFASTLED="FASTLED"'
'-DZsensorINA226="INA226"'
'-DZsensorHCSR501="HCSR501"'
'-DZsensorADC="ADC"'
'-DZsensorBH1750="BH1750"'
'-DZsensorBME280="BME280"'
'-DZsensorTSL2561="TSL2561"'
'-DZsensorDHT="DHT"'
'-DZgatewayRFM69="RFM69"'
'-DZsensorGPIOInput="GPIOInput"'
'-DZsensorGPIOKeyCode="GPIOKeyCode"'
'-DGateway_Name="OpenMQTTGateway_ESP8266_ALL"'
board_build.flash_mode = dout
[env:nodemcuv2-ble]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
${com-esp.lib_deps}
${libraries.wire}
${libraries.esp8266_mdns}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DGateway_Name="OpenMQTTGateway_ESP8266_BLE"'
board_build.flash_mode = dout
[env:nodemcuv2-ir]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
${com-esp.lib_deps}
${libraries.irremoteesp}
${libraries.esp8266_mdns}
build_flags =
${com-esp.build_flags}
'-DZgatewayIR="IR"'
'-DGateway_Name="OpenMQTTGateway_ESP8266_IR"'
board_build.flash_mode = dout
[env:nodemcuv2-rf]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
${com-esp.lib_deps}
${libraries.rc-switch}
${libraries.esp8266_mdns}
build_flags =
${com-esp.build_flags}
'-DZgatewayRF="RF"'
'-DGateway_Name="OpenMQTTGateway_ESP8266_RF"'
board_build.flash_mode = dout
[env:atmega-all]
platform = ${com.atmelavr_platform}
board = megaatmega2560
lib_deps =
${common.lib_deps}
IRremote
Ethernet
FastLED
${com-arduino.lib_deps}
${libraries.irremote}
${libraries.rfm69}
${libraries.rc-switch}
${libraries.newremoteswitch}
${libraries.bme280}
${libraries.bmp180}
${libraries.unifiedsensor}
${libraries.dht}
${libraries.tsl2561}
${libraries.a6lib}
${libraries.ina226}
${libraries.fastled}
build_flags =
${common.build_flags}
${com-arduino.build_flags}
'-DZgatewayRF="RF"'
'-DZgatewayRF="RF315"'
'-DZgatewayRF2="RF2"'
'-DZgatewayIR="IR"'
;'-DZgatewayBT="BT"'
'-DZactuatorONOFF="ONOFF"'
'-DZactuatorFASTLED="FASTLED"'
'-DZsensorINA226="INA226"'
'-DZsensorHCSR501="HCSR501"'
'-DZsensorADC="ADC"'
'-DZsensorBH1750="BH1750"'
'-DZsensorBME280="BME280"'
'-DZsensorTSL2561="TSL2561"'
'-DZsensorDHT="DHT"'
'-DZgatewayRFM69="RFM69"'
'-DZsensorGPIOInput="GPIOInput"'
;'-DZsensorGPIOKeyCode="GPIOKeyCode"'
'-DZmqttDiscovery="HADiscovery"'
'-DGateway_Name="OpenMQTTGateway_ATMEGA_ALL"'
[env:uno]
framework = ${common.framework}
platform = atmelavr
[env:uno-rf]
platform = ${com.atmelavr_platform}
board = uno
lib_deps =
${common.lib_deps}
IRremote
Ethernet
FastLED
${com-arduino.lib_deps}
${libraries.rc-switch}
build_flags =
${common.build_flags}
${com-arduino-low-memory.build_flags}
'-DZgatewayRF="RF"'
'-DGateway_Name="OpenMQTTGateway_UNO_RF"'
[env:uno-fastled]
platform = ${com.atmelavr_platform}
board = uno
lib_deps =
${com-arduino.lib_deps}
${libraries.fastled}
build_flags =
${com-arduino-low-memory.build_flags}
'-DGateway_Name="OpenMQTTGateway_UNO_RF"'
'-DZactuatorFASTLED="FASTLED"'
;extra_configs =
; tests/*_env.ini
+2 -107
View File
@@ -124,112 +124,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
// VCC ------------D|-----------/\/\/\/\ ----------------- Arduino PIN
// LED Resistor 270-510R
/*-------------DEFINE THE MODULES YOU WANT BELOW----------------*/
//Addons and module management, comment the Z line and the config file if you don't use
#if defined(ESP8266) // for nodemcu, weemos, esp8266, and Arduino mega
#define ZgatewayRF "RF"
//#define ZgatewayLORA "LORA" (not tested yet)
#define ZgatewaySRFB "SRFB"
#define ZgatewayRF2 "RF2"
#define ZgatewayIR "IR"
#define ZgatewayBT "BT"
#define Zgateway2G "2G"
#define ZgatewayPilight "Pilight"
#define ZactuatorONOFF "ONOFF"
#define ZsensorINA226 "INA226"
#define ZsensorHCSR501 "HCSR501"
#define ZsensorADC "ADC"
#define ZsensorBH1750 "BH1750"
#define ZsensorBME280 "BME280"
#define ZsensorTSL2561 "TSL2561"
#define ZsensorDHT "DHT"// If you uncomment this you can't use I2C due to the fact that I2C use also D1
#define ZgatewayRFM69 "RFM69"// If you uncomment this you can't use RF and BT due to the fact that RF use also D8 and BT use also D6/D7
#define ZsensorGPIOInput "GPIOInput"
#define ZsensorGPIOKeyCode "GPIOKeyCode"
#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, EPS32, Sonoff RF Bridge
#define jsonPublishing true
#define jsonReceiving true
#define simplePublishing true
#define simpleReceiving true
#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
#define TRACE 1 // commented = trace off, uncommented = trace on
#elif ESP32
#define ZgatewayRF "RF"
#define ZgatewayLORA "LORA"
#define ZgatewayRF "RF315"
#define ZgatewayRF2 "RF2"
//#define Zgateway2G (not tested yet)
#define ZgatewayIR "IR"
#define ZgatewayBT "BT"
#define ZactuatorONOFF "ONOFF"
#define ZsensorINA226 "INA226" //ESP8266, Arduino, ESP32
#define ZsensorHCSR501 "HCSR501" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
#define ZsensorADC "ADC" //ESP8266, Arduino, ESP32
#define ZsensorBH1750 "BH1750" //ESP8266, Arduino, ESP32
#define ZsensorBME280 "BME280" //ESP8266, Arduino, ESP32
#define ZsensorTSL2561 "TSL2561"
#define ZsensorDHT "DHT"
#define ZgatewayRFM69 "RFM69"
#define ZsensorGPIOInput "GPIOInput"
#define ZsensorGPIOKeyCode "GPIOKeyCode"
#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, EPS32, Sonoff RF Bridge
#define jsonPublishing true
#define jsonReceiving true
#define simplePublishing true
#define simpleReceiving true
#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
#define TRACE 1 // commented = trace off, uncommented = trace on
#elif defined(__AVR_ATmega1280__)
#define ZgatewayRF "RF"
//#define ZgatewayLORA "LORA" (not tested yet)
#define ZgatewaySRFB "SRFB"
#define ZgatewayRF2 "RF2"
#define ZgatewayIR "IR"
#define ZgatewayBT "BT"
#define Zgateway2G "2G"
//#define ZgatewayPilight "Pilight"
#define ZactuatorONOFF "ONOFF"
#define ZsensorINA226 "INA226"
#define ZsensorHCSR501 "HCSR501"
#define ZsensorADC "ADC"
#define ZsensorBH1750 "BH1750"
#define ZsensorBME280 "BME280"
#define ZsensorTSL2561 "TSL2561"
#define ZsensorDHT "DHT"// If you uncomment this you can't use I2C due to the fact that I2C use also D1
#define ZgatewayRFM69 "RFM69"// If you uncomment this you can't use RF and BT due to the fact that RF use also D8 and BT use also D6/D7
#define ZsensorGPIOInput "GPIOInput"
#define ZsensorGPIOKeyCode "GPIOKeyCode"
#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, EPS32, Sonoff RF Bridge
#define jsonPublishing true
#define jsonReceiving true
#define simplePublishing true
#define simpleReceiving true
#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
#define TRACE 1 // commented = trace off, uncommented = trace on
#else // for arduino Uno
//#define ZgatewayRF "RF"
//#define ZgatewayLORA "LORA" (not tested yet)
//#define Zgateway2G (not tested yet)
//#define ZgatewayRF2 // too big for UNO
//#define ZgatewayIR
//#define ZgatewayBT
//#define ZactuatorONOFF
//#define ZsensorINA226
//#define ZsensorDHT
//#define ZsensorBH1750
//#define ZsensorBME280
//#define ZsensorHCSR501
//#define ZsensorADC
//#define ZgatewayRFM69 //not tested
//#define ZsensorGPIOInput //not tested
//#define ZsensorGPIOKeyCode "GPIOKeyCode" //not tested
#define jsonPublishing true
#define jsonReceiving true
//#define simplePublishing true
//#define simpleReceiving true
#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
//#define TRACE 1 // commented = trace off, uncommented = trace on
#endif
/*----------------------------OTHER PARAMETERS-----------------------------*/
#ifdef ZgatewaySRFB
#define SERIAL_BAUD 19200
@@ -252,7 +147,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
//#define multiCore //uncomment to use multicore function of ESP32 for BLE
#endif
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#define JSON_MSG_BUFFER 1024 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#else // boards with smaller memory
#define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#endif