From 85ef3038ae99e5c6431676f51ee4488572adf78e Mon Sep 17 00:00:00 2001
From: "s.oezguer" <s.oezguer@b2563226-3b6e-f880-5363-0e5704bc5351>
Date: Sun, 18 Sep 2011 21:25:52 +0000
Subject: [PATCH] undo r116

---
 RCSwitch.cpp | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/RCSwitch.cpp b/RCSwitch.cpp
index 29b861a..253273c 100644
--- a/RCSwitch.cpp
+++ b/RCSwitch.cpp
@@ -256,7 +256,6 @@ void RCSwitch::send(char* sCodeWord) {
       i++;
     }
     this->sendSync();
-
   }
 }
 
@@ -267,13 +266,10 @@ void RCSwitch::transmit(int nHighPulses, int nLowPulses) {
     if (this->nReceiverInterrupt != -1) {
       this->disableReceive();
     }
-	
-    digitalWrite(this->nTransmitterPin, LOW);
-    delayMicroseconds( this->nPulseLength * nHighPulses);
     digitalWrite(this->nTransmitterPin, HIGH);
-    delayMicroseconds( this->nPulseLength * nLowPulses);
+    delayMicroseconds( this->nPulseLength * nHighPulses);
     digitalWrite(this->nTransmitterPin, LOW);
-	
+    delayMicroseconds( this->nPulseLength * nLowPulses);
     if (nRec != -1) {
       this->enableReceive(nRec, this->mCallback);
     }
@@ -286,7 +282,7 @@ void RCSwitch::transmit(int nHighPulses, int nLowPulses) {
  * Waveform: | |___
  */
 void RCSwitch::send0() {
-  this->transmit(2,1);
+  this->transmit(1,3);
 }
 
 /**
@@ -295,7 +291,7 @@ void RCSwitch::send0() {
  * Waveform: |   |_
  */
 void RCSwitch::send1() {
-  this->transmit(1,2);
+  this->transmit(3,1);
 }
 
 
@@ -335,7 +331,7 @@ void RCSwitch::sendTF() {
  * Waveform: | |_______________________________
  */
 void RCSwitch::sendSync() {
-  this->transmit(22,1);
+  this->transmit(1,31);
 }
 
 /**
@@ -380,9 +376,9 @@ void RCSwitch::receiveInterrupt() {
       unsigned long delayTolerance = delay*0.3;    
       for (int i = 1; i<changeCount ; i=i+2) {
       
-          if (timings[i] > delay-delayTolerance && timings[i] < delay+delayTolerance && timings[i+1] > delay*2-delayTolerance && timings[i+1] < delay*2+delayTolerance) {
+          if (timings[i] > delay-delayTolerance && timings[i] < delay+delayTolerance && timings[i+1] > delay*3-delayTolerance && timings[i+1] < delay*3+delayTolerance) {
             code = code << 1;
-          } else if (timings[i] > delay*2-delayTolerance && timings[i] < delay*+delayTolerance && timings[i+1] > delay-delayTolerance && timings[i+1] < delay+delayTolerance) {
+          } else if (timings[i] > delay*3-delayTolerance && timings[i] < delay*+delayTolerance && timings[i+1] > delay-delayTolerance && timings[i+1] < delay+delayTolerance) {
             code+=1;
             code = code << 1;
           } else {
-- 
GitLab