Andriy Makukha / Mbed 2 deprecated football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
67:5650f461722a
Parent:
66:18c214707b0c
Child:
70:bd4b1e19a0c6
--- a/proto_code.cpp	Tue Jan 19 07:25:15 2016 +0000
+++ b/proto_code.cpp	Thu Feb 11 17:47:28 2016 +0000
@@ -298,7 +298,8 @@
     m->value = m_in->value;
     m->command = 'z';
     m->cone = 1;
-    ta.send(m);
+    //// ta.send(m);
+    ta.send_immediate(m);
   }
   
   timer = millis() - start;
@@ -521,13 +522,13 @@
       m->cone = active_cone;
       ta.send(m);
 
-      wait_ms(50);
+////      wait_ms(50);
 ///      wait_ms(300);
       m->command = 't';
       m->value = (uint32_t)timeout;
       ta.send(m);
 
-      wait_ms(50);
+////      wait_ms(50);
 ///      wait_ms(300);
       m->command = 'g';
       ta.send(m);
@@ -1167,8 +1168,9 @@
     ta.send_immediate(m);
 
     unsigned long st = millis();
+    unsigned long delta = 0L;
+   /* ///
     unsigned long current = 0L;
-    unsigned long delta = 0L;
     
     if(Dbg)
     {  
@@ -1210,6 +1212,20 @@
     }
     
     wait_us(50);
+   */ ///
+    while( 1 ) ////
+    {
+      delta = millis() - st;
+      if( delta > 50 )  break;
+      ta.spin();
+      if( ta.recieve( m_in ) )
+      {
+        lonely = false;
+        active_cones[m_in->cone] = true;
+        DEBUG( "Reply from cone: %d, %dms\r\n", m_in->cone, delta );
+        break;
+      }
+    }
   }
 
   writeToPhone("Available cones are: (1");