Skip to content

Commit ae484e2

Browse files
committed
Add command to change timeout in RfReceive
Add command to change timeout in RfReceive (#15061)
1 parent 15ce5ac commit ae484e2

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
- NeoPool system voltages display
1313
- Full DS3231 integration and synchronisation when using UBX (=GPS), NTP or manual time
1414
- LVGL Splash screen and ``SetOption135 1`` to disable splash screen
15+
- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 (#15061)
1516

1617
### Changed
1718
- Extent number of pulsetimers from 8 to 32 (#8266)

‎RELEASENOTES.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
107107
### Added
108108
- Command ``SspmMap 0`` to reset Sonoff SPM default mapping
109109
- Command ``TcpConnect <port><ip_address>`` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874)
110+
- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 [#15061](https://github.com/arendst/Tasmota/issues/15061)
110111
- Commands ``Sensor12 D0 .. D5, S0 .. S5`` allowing differential or single-ended modes [#15001](https://github.com/arendst/Tasmota/issues/15001)
111112
- NeoPool commands ``NPpHMin``, ``NPpHMax``, ``NPpH``, ``NPRedox``, ``NPHydrolysis``, ``NPIonization``, ``NPChlorine`` and ``NPControl`` [#15015](https://github.com/arendst/Tasmota/issues/15015)
112113
- NeoPool system voltages display

‎tasmota/settings.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,9 @@ typedef struct {
633633
int8_t shutter_tilt_config[5][MAX_SHUTTERS]; //508
634634
int8_t shutter_tilt_pos[MAX_SHUTTERS]; //51C
635635
uint16_t influxdb_period; // 520
636+
uint16_t rf_duplicate_time; // 522
636637

637-
uint8_t free_522[10]; // 522
638+
uint8_t free_524[8]; // 524
638639

639640
uint16_t mqtt_keepalive; // 52C
640641
uint16_t mqtt_socket_timeout; // 52E

‎tasmota/xdrv_17_rcswitch.ino‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@
2727
#define D_JSON_RF_BITS "Bits"
2828
#define D_JSON_RF_DATA "Data"
2929

30-
#define D_CMND_RFSEND "RFSend"
31-
#define D_CMND_RFPROTOCOL "RfProtocol"
30+
#define D_CMND_RFSEND "Send"
31+
#define D_CMND_RFPROTOCOL "Protocol"
32+
#define D_CMND_RFTIMEOUT "TimeOut"
3233

3334
#define D_JSON_RF_PULSE "Pulse"
3435
#define D_JSON_RF_REPEAT "Repeat"
3536
#define D_JSON_NONE_ENABLED "None Enabled"
3637

37-
const char kRfCommands[] PROGMEM = "|" // No prefix
38-
D_CMND_RFSEND "|" D_CMND_RFPROTOCOL;
38+
const char kRfCommands[] PROGMEM = "Rf|" // No prefix
39+
D_CMND_RFSEND "|" D_CMND_RFPROTOCOL "|" D_CMND_RFTIMEOUT;
3940

4041
void (* const RfCommands[])(void) PROGMEM = {
41-
&CmndRfSend, &CmndRfProtocol };
42+
&CmndRfSend, &CmndRfProtocol, &CmndRfTimeOut};
4243

4344
#include <RCSwitch.h>
4445

@@ -59,7 +60,7 @@ void RfReceiveCheck(void) {
5960
AddLog(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay);
6061

6162
uint32_t now = millis();
62-
if ((now - rf_lasttime > RF_TIME_AVOID_DUPLICATE) && (data > 0)) {
63+
if ((now - rf_lasttime > Settings->rf_duplicate_time) && (data > 0)) {
6364
rf_lasttime = now;
6465

6566
char stemp[16];
@@ -84,6 +85,9 @@ void RfInit(void) {
8485
mySwitch.enableTransmit(Pin(GPIO_RFSEND));
8586
}
8687
if (PinUsed(GPIO_RFRECV)) {
88+
if (Settings->rf_duplicate_time < 10) {
89+
Settings->rf_duplicate_time = RF_TIME_AVOID_DUPLICATE;
90+
}
8791
pinMode( Pin(GPIO_RFRECV), INPUT);
8892
mySwitch.enableReceive(Pin(GPIO_RFRECV));
8993
if (!Settings->rf_protocol_mask) {
@@ -214,6 +218,13 @@ void CmndRfSend(void)
214218
}
215219
}
216220

221+
void CmndRfTimeOut(void) {
222+
if (XdrvMailbox.payload >= 10) {
223+
Settings->rf_duplicate_time = XdrvMailbox.payload;
224+
}
225+
ResponseCmndNumber(Settings->rf_duplicate_time);
226+
}
227+
217228
/*********************************************************************************************\
218229
* Interface
219230
\*********************************************************************************************/

0 commit comments

Comments
 (0)