Andriy Makukha / Mbed 2 deprecated football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
60:d1fad57e8bfb
Parent:
59:297133497153
Child:
61:dd7002ceea96
--- a/proto_code.cpp	Sat Jan 16 17:31:27 2016 +0000
+++ b/proto_code.cpp	Sat Jan 16 19:11:49 2016 +0000
@@ -398,8 +398,11 @@
     {
       active_cone = getRandomCone(); 
 
-      if( Dbg )  writeToPhone("GN_AC: %d\r\n", active_cone);
-
+      if(Dbg)
+      { 
+         writeToPhone("GN_AC: %d\r\n", active_cone);
+      }
+      
       mask = 0x07;
       ta.setMask(mask & LIGHTS);
       timeout = ~0;
@@ -435,7 +438,11 @@
   
     if(ta.recieve(m_in))
     {
-        if( Dbg )  writeToPhone("SR: %d '%c'\r\n", m_in->cone, m_in->command);
+        if(Dbg)
+        {  
+            writeToPhone("SR: %d '%c'\r\n", m_in->cone, m_in->command);
+        }
+        
         command = m_in->command;
         value = m_in->value;
     }
@@ -531,7 +538,10 @@
       m->command = 'g';
       ta.send(m);
       
-      if( Dbg )  writeToPhone("ACW: %d\r\n", active_cone);
+      if(Dbg)
+      {  
+        writeToPhone("ACW: %d\r\n", active_cone);
+      }
     }
     
     ta.post_color(( ta.activated())?touch_colour:idle_colour);
@@ -552,13 +562,20 @@
       
       if(state_p == WAITING_P) 
       {
-        if( Dbg )  writeToPhone("NSW\r\n");
+        if(Dbg)
+        {  
+            writeToPhone("NSW\r\n");
+        }
+        
         new_state = true;
-        }
+      }
     }
     else if(~timeout != 0 && mode == PATTERN && timer >= (timeout + ((fail_quick)?0:GRACE_PERIOD)))
     {
-      if( Dbg )  writeToPhone("FW\r\n");
+      if(Dbg)
+      {  
+        writeToPhone("FW\r\n");
+      }
       state_p = FAIL_P;
     }
     break;
@@ -763,8 +780,6 @@
     }
     else
     {
-      write_test_pattern();
-      datastore_read_patterns();
       writeToPhone("Selected pattern %d\r\n", value);
       
       if(value <= SEQUENCES && value > 0)
@@ -774,9 +789,12 @@
         times = (uint16_t*)time_table + (value-1)*STATIONS;
         masks = (uint8_t*)mask_table + (value-1)*STATIONS;
         
-        for (int i = 0; i < STATIONS; ++i)
+        if (Dbg)
         {
-            writeToPhone("PS: %d %x %d\r\n", cones[i], masks[i], times[i]);    
+            for (int i = 0; i < STATIONS; ++i)
+            {
+                writeToPhone("PS: %d %x %d\r\n", cones[i], masks[i], times[i]);    
+            }
         }
       }
       else
@@ -1131,7 +1149,10 @@
   
   lonely = true;
   
-  if( Dbg )  writeToPhone("FC\r\n");
+  if(Dbg)
+  {
+      writeToPhone("FC\r\n");
+  }
   
   int retry_count = 0;
 
@@ -1147,7 +1168,10 @@
     unsigned long current = 0L;
     unsigned long delta = 0L;
     
-    if( Dbg )  writeToPhone("S: %lu F: %d\r\n", st, i);
+    if(Dbg)
+    {  
+        writeToPhone("S: %lu F: %d\r\n", st, i);
+    }
 
     while(1)
     {
@@ -1156,7 +1180,10 @@
       
       if(delta > 300L) 
       {
-        if( Dbg )  writeToPhone("FT: %d %lu\r\n", i, current);
+        if(Dbg)
+        {  
+            writeToPhone("FT: %d %lu\r\n", i, current);
+        }
         
         if (++retry_count < 3)
         {
@@ -1172,7 +1199,10 @@
         lonely = false;
         active_cones[m_in->cone] = true;
         
-        if( Dbg )  writeToPhone("FS: %d\r\n", m_in->cone);
+        if(Dbg)
+        {  
+            writeToPhone("FS: %d\r\n", m_in->cone);
+        }
         break;
       }
     }