Alexandre Lemay / Mbed 2 deprecated APP4_FunTimes

Dependencies:   mbed mbed-rtos

Revision:
9:8f479f7c1b54
Parent:
8:7c56fb1ed8c0
--- a/Receiver.cpp	Wed Oct 25 04:17:42 2017 +0000
+++ b/Receiver.cpp	Wed Oct 25 05:43:13 2017 +0000
@@ -16,8 +16,10 @@
 {
     if(dataReady.wait(2)==0)
     {
+        timedOut = true;
         return BitData::timeout;
     }
+    
     char val = data[currentData];
     currentData++;
     if(currentData==size)
@@ -46,12 +48,12 @@
         if(mode == BitData::zero)
         {
             lastTime = curTime;
-            pushData(BitData::zero);
-            return;
+            pushData(BitData::zero);   
         }
+        return;
     }
     // data
-    if(dif > us_prepare)
+    else if(dif > us_prepare)
     {
         lastTime = curTime;
         pushData(mode);
@@ -96,10 +98,11 @@
             val = val|(1 << 7-i);
             break;
         case BitData::timeout:
+            val = 0;
             return false;       
         }
     }
-    pc.printf(" byte:%i\n",val);
+    //pc.printf(" byte:%i\n",val);
     return true;
 }