diff --git a/main/config_GPIOInput.h b/main/config_GPIOInput.h index edb1939..04f5b67 100644 --- a/main/config_GPIOInput.h +++ b/main/config_GPIOInput.h @@ -34,10 +34,12 @@ extern void GPIOInputtoMQTT(); #define GPIOInputDebounceDelay 60 //debounce time, increase if there are issues /*-------------------PIN DEFINITIONS----------------------*/ -#if defined(ESP8266) || defined(ESP32) - #define GPIOInput_PIN 14 -#else - #define GPIOInput_PIN 7 +#ifndef GPIOInput_PIN + #if defined(ESP8266) || defined(ESP32) + #define GPIOInput_PIN 14 + #else + #define GPIOInput_PIN 7 + #endif #endif -#endif \ No newline at end of file +#endif diff --git a/main/config_ONOFF.h b/main/config_ONOFF.h index 55b665e..4545882 100644 --- a/main/config_ONOFF.h +++ b/main/config_ONOFF.h @@ -35,12 +35,14 @@ extern void MQTTtoONOFF(char * topicOri, JsonObject& RFdata); #define subjectGTWONOFFtoMQTT Base_Topic Gateway_Name "/ONOFFtoMQTT" /*-------------------PIN DEFINITIONS----------------------*/ -#ifdef ESP8266 - #define ACTUATOR_ONOFF_PIN 15 //12 for sonoff basic relay -#elif ESP32 - #define ACTUATOR_ONOFF_PIN 15 -#else - #define ACTUATOR_ONOFF_PIN 13 +#ifndef ACTUATOR_ONOFF_PIN + #ifdef ESP8266 + #define ACTUATOR_ONOFF_PIN 15 //12 for sonoff basic relay + #elif ESP32 + #define ACTUATOR_ONOFF_PIN 15 + #else + #define ACTUATOR_ONOFF_PIN 13 + #endif #endif #endif \ No newline at end of file diff --git a/main/config_RF.h b/main/config_RF.h index 93122b5..2029fec 100644 --- a/main/config_RF.h +++ b/main/config_RF.h @@ -91,20 +91,30 @@ RF supported protocols #define repeatPilightwMQTT false // do we repeat a received signal by using mqtt with Pilight gateway /*-------------------PIN DEFINITIONS----------------------*/ -#ifdef ESP8266 - #define RF_RECEIVER_PIN 0 // D3 on nodemcu // put 4 with rf bridge direct mod - #define RF_EMITTER_PIN 3 // RX on nodemcu if it doesn't work with 3, try with 4 (D2) // put 5 with rf bridge direct mod -#elif ESP32 - #define RF_RECEIVER_PIN 27 // D27 on DOIT ESP32 - #define RF_EMITTER_PIN 12 // D12 on DOIT ESP32 -#elif __AVR_ATmega2560__ - #define RF_RECEIVER_PIN 1 //1 = D3 on mega - #define RF_EMITTER_PIN 4 -#else - //IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library IRremote/boarddefs.h so as to free pin D3 for RF RECEIVER PIN - //RF PIN definition - #define RF_RECEIVER_PIN 1 //1 = D3 on arduino - #define RF_EMITTER_PIN 4 //4 = D4 on arduino +#ifndef RF_RECEIVER_PIN + #ifdef ESP8266 + #define RF_RECEIVER_PIN 0 // D3 on nodemcu // put 4 with rf bridge direct mod + #elif ESP32 + #define RF_RECEIVER_PIN 27 // D27 on DOIT ESP32 + #elif __AVR_ATmega2560__ + #define RF_RECEIVER_PIN 1 //1 = D3 on mega + #else + #define RF_RECEIVER_PIN 1 //1 = D3 on arduino + #endif +#endif + +#ifndef RF_EMITTER_PIN + #ifdef ESP8266 + #define RF_EMITTER_PIN 3 // RX on nodemcu if it doesn't work with 3, try with 4 (D2) // put 5 with rf bridge direct mod + #elif ESP32 + #define RF_EMITTER_PIN 12 // D12 on DOIT ESP32 + #elif __AVR_ATmega2560__ + #define RF_EMITTER_PIN 4 + #else + //IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library IRremote/boarddefs.h so as to free pin D3 for RF RECEIVER PIN + //RF PIN definition + #define RF_EMITTER_PIN 4 //4 = D4 on arduino + #endif #endif #endif \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 21907e4..f57c209 100644 --- a/platformio.ini +++ b/platformio.ini @@ -22,6 +22,7 @@ extra_configs = ;you can also adapt the modules by removing the corresponding lines in the env detail ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;default_envs = sonoff-basic-rfr3 ;default_envs = rfbridge ;default_envs = esp32dev-all ;default_envs = esp32dev-rf @@ -299,6 +300,24 @@ build_flags = '-DGateway_Name="OpenMQTTGateway_ESP8266_RF"' board_build.flash_mode = dout +[env:sonoff-basic-rfr3] +platform = ${com.esp8266_platform} +board = esp8285 +lib_deps = + ${com-esp.lib_deps} + ${libraries.rc-switch} + ${libraries.esp8266_mdns} +build_flags = + ${com-esp.build_flags} + '-DZactuatorONOFF="ONOFF"' + '-DZsensorGPIOInput="GPIOInput"' + '-DACTUATOR_ONOFF_PIN=12' + '-DGPIOInput_PIN=0' + '-DRF_RECEIVER_PIN=4' + '-DZgatewayRF="RF"' + '-DGateway_Name="OpenMQTTGateway_SONOFF_BASIC_RFR3"' +board_build.flash_mode = dout + [env:atmega-all] platform = ${com.atmelavr_platform} board = megaatmega2560