Luka Slapnik / sbus_decode
Revision:
14:481c23f2e4eb
Parent:
13:17a61a516f0c
Child:
15:c96df23cad7d
--- a/SBUS.cpp	Mon Jul 15 00:50:24 2019 +0000
+++ b/SBUS.cpp	Mon Jul 15 09:05:23 2019 +0000
@@ -43,14 +43,14 @@
     char buf;
     
     buf = com.getc();
+    if(count >= 25) return;
+    receivedData[count] = buf;
+    count++;
     
-    if(buf == 0x0F) {
+    if(count == 25 && receivedData[0] == 0x0F) {
         decordReceivedData();
         count = 0;
     }
-    if(count >= 25) return;
-    receivedData[count] = buf;
-    count++;
 }
 
 void SBUS::decordReceivedData() {