diff --git a/tasmota/i18n.h b/tasmota/i18n.h
index 4d2f0f2d6..807f1d5c6 100644
--- a/tasmota/i18n.h
+++ b/tasmota/i18n.h
@@ -497,9 +497,6 @@
#define D_JSON_RFRECEIVED "RfReceived"
#define D_CMND_RFRAW "RfRaw"
-#define D_CMND_RFRXPROTOCOL "RfRxProtocol"
-#define D_JSON_ENABLED_MASK "Enabled-Mask"
-
// Commands xdrv_08_serial_bridge.ino
#define D_CMND_SSERIALSEND "SSerialSend"
#define D_CMND_SBAUDRATE "SBaudrate"
diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino
index e29d8433d..da7ff3a1c 100644
--- a/tasmota/support_command.ino
+++ b/tasmota/support_command.ino
@@ -18,9 +18,6 @@
*/
const char kTasmotaCommands[] PROGMEM = "|" // No prefix
-#ifdef USE_RC_SWITCH
- D_CMND_RFRXPROTOCOL "|"
-#endif
D_CMND_BACKLOG "|" D_CMND_DELAY "|" D_CMND_POWER "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_SLEEP "|" D_CMND_UPGRADE "|" D_CMND_UPLOAD "|" D_CMND_OTAURL "|"
D_CMND_SERIALLOG "|" D_CMND_RESTART "|" D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|" D_CMND_BLINKTIME "|" D_CMND_BLINKCOUNT "|" D_CMND_SAVEDATA "|"
D_CMND_SO "|" D_CMND_SETOPTION "|" D_CMND_TEMPERATURE_RESOLUTION "|" D_CMND_HUMIDITY_RESOLUTION "|" D_CMND_PRESSURE_RESOLUTION "|" D_CMND_POWER_RESOLUTION "|"
@@ -47,9 +44,6 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix
#endif // ESP32
;
void (* const TasmotaCommand[])(void) PROGMEM = {
-#ifdef USE_RC_SWITCH
- &CmndRfRxProtocol,
-#endif
&CmndBacklog, &CmndDelay, &CmndPower, &CmndStatus, &CmndState, &CmndSleep, &CmndUpgrade, &CmndUpgrade, &CmndOtaUrl,
&CmndSeriallog, &CmndRestart, &CmndPowerOnState, &CmndPulsetime, &CmndBlinktime, &CmndBlinkcount, &CmndSavedata,
&CmndSetoption, &CmndSetoption, &CmndTemperatureResolution, &CmndHumidityResolution, &CmndPressureResolution, &CmndPowerResolution,
diff --git a/tasmota/xdrv_17_rcswitch.ino b/tasmota/xdrv_17_rcswitch.ino
index 779d4def9..fad417d8f 100644
--- a/tasmota/xdrv_17_rcswitch.ino
+++ b/tasmota/xdrv_17_rcswitch.ino
@@ -16,11 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#include
-#include "my_user_config.h"
-
-// doesn't pickup defines while editing without this
-// dunno if this is unique to my enviroment or everyone experiences it ..
#ifdef USE_RC_SWITCH
/*********************************************************************************************\
* RF send and receive using RCSwitch library https://github.com/sui77/rc-switch/
@@ -35,12 +30,15 @@
#define D_CMND_RFSEND "RFSend"
#define D_JSON_RF_PULSE "Pulse"
#define D_JSON_RF_REPEAT "Repeat"
+#define D_CMND_RFRXPROTOCOL "RfRxProtocol"
+#define D_JSON_NONE_ENABLED "None Enabled"
-const char kRfSendCommands[] PROGMEM = "|" D_CMND_RFSEND; // No prefix
-
-void (* const RfSendCommand[])(void) PROGMEM = {
- &CmndRfSend };
+const char kRfCommands[] PROGMEM = "|" D_CMND_RFSEND "|" D_CMND_RFRXPROTOCOL; // No prefix
+
+
+void (* const RfCommands[])(void) PROGMEM = {
+ &CmndRfSend,&CmndRfRxProtocol };
#include
@@ -90,58 +88,66 @@ void RfInit(void)
if (PinUsed(GPIO_RFRECV)) {
pinMode( Pin(GPIO_RFRECV), INPUT);
mySwitch.enableReceive(Pin(GPIO_RFRECV));
- mySwitch.enabled_protocol_mask.longs.high32 = Settings.ex_adc_param1;
- mySwitch.enabled_protocol_mask.longs.low32 = Settings.ex_adc_param2;
+ GetMaskFromSettings();
}
}
-
+void GetMaskFromSettings(){
+ mySwitch.enabled_protocol_mask.longs.high32 = Settings.ex_adc_param1 ;
+ mySwitch.enabled_protocol_mask.longs.low32 = Settings.ex_adc_param2 ;
+}
+void SaveMaskToSettings(){
+ Settings.ex_adc_param1 = mySwitch.enabled_protocol_mask.longs.high32;
+ Settings.ex_adc_param2 = mySwitch.enabled_protocol_mask.longs.low32;
+ SettingsSave(1);
+}
/*********************************************************************************************\
* Commands
\*********************************************************************************************/
void CmndRfRxProtocol(void){
- uint64_t thisbit;
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: index:%d usridx:%d data_len:%d data:%s"),XdrvMailbox.index, XdrvMailbox.usridx, XdrvMailbox.data_len,XdrvMailbox.data);
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: test data_len >0"));
- //if (XdrvMailbox.data_len > 0) {
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: test usridx ==1"));
- if (XdrvMailbox.usridx==1) {
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: test payload >=0"));
- if(XdrvMailbox.payload >=0){
- thisbit = (1ULL << (XdrvMailbox.index-1) );
- if(XdrvMailbox.payload &1){
- mySwitch.enabled_protocol_mask.value |= thisbit;
- }else{
- mySwitch.enabled_protocol_mask.value &= ~thisbit;
- }
- }
- }else{
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: test for a"));
- if(XdrvMailbox.data[0]=='a'){
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: set mask all"));
- mySwitch.enabled_protocol_mask.value= (1ULL << mySwitch.getNumProtos())-1 ;
+ if(!PinUsed(GPIO_RFRECV))return;
+// AddLog_P(LOG_LEVEL_INFO, PSTR("RFR:CmndRfRxProtocol:: index:%d usridx:%d data_len:%d data:\"%s\""),XdrvMailbox.index, XdrvMailbox.usridx, XdrvMailbox.data_len,XdrvMailbox.data);
+
+ uint64_t thisdat;
+ if (XdrvMailbox.usridx==1) {
+ if(XdrvMailbox.payload >=0){
+ thisdat = (1ULL << (XdrvMailbox.index-1) );
+ if(XdrvMailbox.payload &1){
+ mySwitch.enabled_protocol_mask.value |= thisdat;
}else{
- // AddLog_P(LOG_LEVEL_INFO, PSTR("RFR: set mask with value"));
- mySwitch.enabled_protocol_mask.value = strtoull(XdrvMailbox.data,nullptr, 0);
+ mySwitch.enabled_protocol_mask.value &= ~thisdat;
+ }
+ SaveMaskToSettings();
+ }else if(XdrvMailbox.data_len > 0) return; // not a number
+ }else{
+ if(XdrvMailbox.data_len >0){
+ if(XdrvMailbox.data[0]=='a'){
+ mySwitch.enabled_protocol_mask.value= (1ULL << mySwitch.getNumProtos())-1 ;
+ SaveMaskToSettings();
+ }else{
+ thisdat = strtoull(XdrvMailbox.data,nullptr, 0);
+ if(thisdat>0 || XdrvMailbox.data[0]=='0' ){
+ mySwitch.enabled_protocol_mask.value = thisdat;
+ SaveMaskToSettings();
+ }else return; // not a number
}
+
}
- Settings.ex_adc_param1 = mySwitch.enabled_protocol_mask.longs.high32;
- Settings.ex_adc_param2 = mySwitch.enabled_protocol_mask.longs.low32;
- //}
+ }
+// AddLog_P(LOG_LEVEL_INFO, PSTR("RFR:CmndRfRxProtocol:: Start responce"));
ResponseClear();
ResponseAppend_P(PSTR("{\"" D_CMND_RFRXPROTOCOL "\":"));
ResponseAppend_P(PSTR("\""));
bool gotone = false;
- thisbit=1;
+ thisdat=1;
for (int i=0;i