Add command to change timeout in RfReceive

Add command to change timeout in RfReceive (#15061)
This commit is contained in:
Theo Arends 2022-03-11 14:10:22 +01:00
parent 15ce5ac6e5
commit ae484e28ba
4 changed files with 21 additions and 7 deletions

View File

@ -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)

View File

@ -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 <port><ip_address>`` 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

View File

@ -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

View File

@ -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 <RCSwitch.h>
@ -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
\*********************************************************************************************/