diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a8ac753..2858db0e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. - NeoPool system voltages display - Full DS3231 integration and synchronisation when using UBX (=GPS), NTP or manual time - LVGL Splash screen and ``SetOption135 1`` to disable splash screen +- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 (#15061) ### Changed - Extent number of pulsetimers from 8 to 32 (#8266) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d11895c16..20f6488f8 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -107,6 +107,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo ### Added - Command ``SspmMap 0`` to reset Sonoff SPM default mapping - Command ``TcpConnect `` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874) +- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 [#15061](https://github.com/arendst/Tasmota/issues/15061) - Commands ``Sensor12 D0 .. D5, S0 .. S5`` allowing differential or single-ended modes [#15001](https://github.com/arendst/Tasmota/issues/15001) - NeoPool commands ``NPpHMin``, ``NPpHMax``, ``NPpH``, ``NPRedox``, ``NPHydrolysis``, ``NPIonization``, ``NPChlorine`` and ``NPControl`` [#15015](https://github.com/arendst/Tasmota/issues/15015) - NeoPool system voltages display diff --git a/tasmota/settings.h b/tasmota/settings.h index 6ef2ba502..4596332f8 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -633,8 +633,9 @@ typedef struct { int8_t shutter_tilt_config[5][MAX_SHUTTERS]; //508 int8_t shutter_tilt_pos[MAX_SHUTTERS]; //51C uint16_t influxdb_period; // 520 + uint16_t rf_duplicate_time; // 522 - uint8_t free_522[10]; // 522 + uint8_t free_524[8]; // 524 uint16_t mqtt_keepalive; // 52C uint16_t mqtt_socket_timeout; // 52E diff --git a/tasmota/xdrv_17_rcswitch.ino b/tasmota/xdrv_17_rcswitch.ino index 0f8fccba4..acf033c85 100644 --- a/tasmota/xdrv_17_rcswitch.ino +++ b/tasmota/xdrv_17_rcswitch.ino @@ -27,18 +27,19 @@ #define D_JSON_RF_BITS "Bits" #define D_JSON_RF_DATA "Data" -#define D_CMND_RFSEND "RFSend" -#define D_CMND_RFPROTOCOL "RfProtocol" +#define D_CMND_RFSEND "Send" +#define D_CMND_RFPROTOCOL "Protocol" +#define D_CMND_RFTIMEOUT "TimeOut" #define D_JSON_RF_PULSE "Pulse" #define D_JSON_RF_REPEAT "Repeat" #define D_JSON_NONE_ENABLED "None Enabled" -const char kRfCommands[] PROGMEM = "|" // No prefix - D_CMND_RFSEND "|" D_CMND_RFPROTOCOL; +const char kRfCommands[] PROGMEM = "Rf|" // No prefix + D_CMND_RFSEND "|" D_CMND_RFPROTOCOL "|" D_CMND_RFTIMEOUT; void (* const RfCommands[])(void) PROGMEM = { - &CmndRfSend, &CmndRfProtocol }; + &CmndRfSend, &CmndRfProtocol, &CmndRfTimeOut}; #include @@ -59,7 +60,7 @@ void RfReceiveCheck(void) { AddLog(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); uint32_t now = millis(); - if ((now - rf_lasttime > RF_TIME_AVOID_DUPLICATE) && (data > 0)) { + if ((now - rf_lasttime > Settings->rf_duplicate_time) && (data > 0)) { rf_lasttime = now; char stemp[16]; @@ -84,6 +85,9 @@ void RfInit(void) { mySwitch.enableTransmit(Pin(GPIO_RFSEND)); } if (PinUsed(GPIO_RFRECV)) { + if (Settings->rf_duplicate_time < 10) { + Settings->rf_duplicate_time = RF_TIME_AVOID_DUPLICATE; + } pinMode( Pin(GPIO_RFRECV), INPUT); mySwitch.enableReceive(Pin(GPIO_RFRECV)); if (!Settings->rf_protocol_mask) { @@ -214,6 +218,13 @@ void CmndRfSend(void) } } +void CmndRfTimeOut(void) { + if (XdrvMailbox.payload >= 10) { + Settings->rf_duplicate_time = XdrvMailbox.payload; + } + ResponseCmndNumber(Settings->rf_duplicate_time); +} + /*********************************************************************************************\ * Interface \*********************************************************************************************/