From 41a5fcda5ca7662447e9b779732c731de660331c Mon Sep 17 00:00:00 2001 From: Sergii Tkachenko Date: Wed, 14 Sep 2016 04:01:35 +0300 Subject: [PATCH 1/2] Fixes #82: Missing sync on first transmit. --- RCSwitch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RCSwitch.cpp b/RCSwitch.cpp index 3ff7374..83018ac 100644 --- a/RCSwitch.cpp +++ b/RCSwitch.cpp @@ -496,13 +496,13 @@ void RCSwitch::send(unsigned long code, unsigned int length) { #endif for (int nRepeat = 0; nRepeat < nRepeatTransmit; nRepeat++) { + this->transmit(protocol.syncFactor); for (int i = length-1; i >= 0; i--) { if (code & (1L << i)) this->transmit(protocol.one); else this->transmit(protocol.zero); } - this->transmit(protocol.syncFactor); } #if not defined( RCSwitchDisableReceiving ) From 703efbcd7c0cc764c9d98bdb32a098eac63a7f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suat=20=C3=96zg=C3=BCr?= Date: Thu, 22 Dec 2016 21:09:39 +0100 Subject: [PATCH 2/2] Update RCSwitch.cpp why not both? --- RCSwitch.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RCSwitch.cpp b/RCSwitch.cpp index 83018ac..d411b01 100644 --- a/RCSwitch.cpp +++ b/RCSwitch.cpp @@ -504,6 +504,8 @@ void RCSwitch::send(unsigned long code, unsigned int length) { this->transmit(protocol.zero); } } + // (start) and end every transmission with a sync bit => issue #82 + this->transmit(protocol.syncFactor); #if not defined( RCSwitchDisableReceiving ) // enable receiver again if we just disabled it