From 094627bcbe31cf02666898832ecd1da943c1462c Mon Sep 17 00:00:00 2001 From: Yves Quemener Date: Sun, 20 Jun 2021 23:27:50 +0900 Subject: [PATCH] Send the syncFactor before the data It is quite possible I totally misunderstood how to properly use this library, but I suspect there was a mistake there: the sync bits were not sent on the first repetition of the data and were appended at the end of the packet. It probably still worked as long as repeat >1 and that there is not interference. --- RCSwitch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RCSwitch.cpp b/RCSwitch.cpp index 99d3cc1..727df01 100644 --- a/RCSwitch.cpp +++ b/RCSwitch.cpp @@ -508,13 +508,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); } // Disable transmit after sending (i.e., for inverted protocols)