From f84a8784000f4f201842e419aa2cbb13908e2dbd Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Wed, 20 Oct 2021 13:08:58 +0200 Subject: [PATCH] Configurable amount of RF2 repeats (#990) * Make number of RF2 repeats configurable * Reduce number of repeats Number of repeats in NewRemoteTransmitter is by default 16, which takes quite some time to send. It actually runs 2^R repeats, where R is the configured amount. https://github.com/1technophile/NewRemoteSwitch/blob/86f1c8486c80919ef70e86504e8a9580c34b4fab/NewRemoteTransmitter.cpp#L20 --- main/ZgatewayRF2.ino | 4 ++-- main/config_RF.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main/ZgatewayRF2.ino b/main/ZgatewayRF2.ino index 07d7f37..d56a8dd 100644 --- a/main/ZgatewayRF2.ino +++ b/main/ZgatewayRF2.ino @@ -210,7 +210,7 @@ void MQTTtoRF2(char* topicOri, char* datacallback) { valuePERIOD = 272; NewRemoteReceiver::disable(); Log.trace(F("Creating transmitter" CR)); - NewRemoteTransmitter transmitter(valueCODE, RF_EMITTER_GPIO, valuePERIOD); + NewRemoteTransmitter transmitter(valueCODE, RF_EMITTER_GPIO, valuePERIOD, RF2_EMITTER_REPEAT); Log.trace(F("Sending data" CR)); if (valueGROUP) { if (isDimCommand) { @@ -287,7 +287,7 @@ void MQTTtoRF2(char* topicOri, JsonObject& RF2data) { // json object decoding if (valuePERIOD == 0) valuePERIOD = 272; NewRemoteReceiver::disable(); - NewRemoteTransmitter transmitter(valueCODE, RF_EMITTER_GPIO, valuePERIOD); + NewRemoteTransmitter transmitter(valueCODE, RF_EMITTER_GPIO, valuePERIOD, RF2_EMITTER_REPEAT); Log.trace(F("Sending" CR)); if (valueGROUP) { if (isDimCommand) { diff --git a/main/config_RF.h b/main/config_RF.h index 45c7c47..30fd1c5 100644 --- a/main/config_RF.h +++ b/main/config_RF.h @@ -79,7 +79,8 @@ int minimumRssi = 0; // subject monitored to listen traffic processed by other gateways to store data and avoid ntuple #define subjectMultiGTWRF "+/+/433toMQTT" //RF number of signal repetition - Can be overridden by specifying "repeat" in a JSON message. -#define RF_EMITTER_REPEAT 20 +#define RF_EMITTER_REPEAT 20 +#define RF2_EMITTER_REPEAT 2 // Actual repeats is 2^R, where R is the here configured amount //#define RF_DISABLE_TRANSMIT //Uncomment this line to disable RF transmissions. (RF Receive will work as normal.) //#define RFmqttDiscovery true //uncomment this line so as to create a discovery switch for each RF signal received