Sooner Competitive Robotics / Mbed 2 deprecated IEEE_14_Freescale

Dependencies:   mbed

Fork of IEEE_14_Freescale by IEEE 2014 Mbed

Revision:
24:46eeab7cebc6
Parent:
23:53cafcd67828
Child:
49:7d172c133dbf
--- a/droidBT.cpp	Thu Mar 13 04:30:24 2014 +0000
+++ b/droidBT.cpp	Thu Mar 13 05:46:36 2014 +0000
@@ -1,5 +1,5 @@
 #include "droidBT.h"
-#include "dbgprint.h"
+#include "nodbgprint.h"
 
 droidBT::droidBT(PinName tx, PinName rx) : droid(tx,rx){
     BTStart=0;
@@ -47,8 +47,10 @@
             if(i==DCStart){
                 DCStart++;
             }
-            for(int j=0;j<17;j++)
+            for(int j=0;j<17;j++){
                 dest[j]=DataChunk[i][j];
+                DataChunk[i][j]=0;
+            }
             return 1;
         }
     }
@@ -58,7 +60,7 @@
 int droidBT::procBuf(int cmd){
     int i=BTStart;
     int startChunk=i;
-    int seen=0;
+    //int seen=0;
     int cheapHash=0;
     while (i!=BTEnd) {
         if(i==startChunk){ //first bit in the chunk
@@ -101,7 +103,7 @@
                     DBGPRINT("Hash Does Not Match\r\n",1);
                     DataChunk[DCEnd][(BTBuffer[startChunk]&0xF)]=0;
                 }
-                DBGPRINT("Got Data of size %d [%x %d %d]\n", BTBuffer[startChunk]&0xF, DataChunk[DCEnd][1], DataChunk[DCEnd][2], DataChunk[DCEnd][3]);
+                DBGPRINT("Got Data of size %d [%x %d %d]\n", BTBuffer[startChunk]&0xF, DataChunk[DCEnd-1][1], DataChunk[DCEnd-1][2], DataChunk[DCEnd-1][3]);
                 
                 BTStart=i+j;
                 startChunk=i=BTStart;
@@ -111,7 +113,7 @@
         }
                 
     }
-    return seen;
+    return 0;
 }
 int droidBT::bufSize(){
     return (BTEnd+BTBUFSIZE-BTStart)%BTBUFSIZE;
@@ -130,7 +132,7 @@
         droid.putc(sendbuf[i]);
         cheapHash^=sendbuf[i];
     }
-    return 0xF300|cheapHash;
+    return 0xF300|(cheapHash&0xFF);
 }
 
 int droidBT::sendCmd(int cmd, int* info, int len) {