Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Revision:
6:324946320c6d
Parent:
2:cffa347bb943
Child:
7:f9c59a3e4155
--- a/ui/ui.cpp	Thu Apr 26 23:49:49 2012 +0000
+++ b/ui/ui.cpp	Fri Apr 27 14:29:56 2012 +0000
@@ -62,33 +62,21 @@
 void UI::printloop() {
 
     char* sync = "ABCD";
+    std::cout.write(sync, 4);
 
     while (1) {
 
-        //output num packets
-        char numidstosend = 0;
-        for (int id = 0; id < NUMIDS; id++)
-            if (newdataflags & (1<<id))
-                numidstosend++;
-
-        if (numidstosend) {
-            std::cout.write(sync, 4);
-            std::cout.put(numidstosend);
-
-            //send packets
-            for (int id = 0; id < NUMIDS; id++) {
-                if (newdataflags & (1<<id)) {
-                    std::cout.put(id);
-                    std::cout.write((char*)buffarr[id], 4*idlist[id]);
-                    newdataflags &= ~(1<<id);
-                }
+        //send packets
+        for (int id = 0; id < NUMIDS; id++) {
+            if (newdataflags & (1<<id)) {
+                std::cout.put(id);
+                std::cout.write((char*)buffarr[id], 4*idlist[id]);
+                newdataflags &= ~(1<<id);
             }
-
-            std::cout.flush();
         }
 
+        std::cout.flush();
         Thread::wait(200);
-
     }
 
 }