football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
62:9b34dc1b265d
Parent:
61:dd7002ceea96
Child:
63:efba30dea1f0
--- a/main.cpp	Sun Jan 17 07:03:51 2016 +0000
+++ b/main.cpp	Mon Jan 18 08:51:31 2016 +0000
@@ -59,6 +59,7 @@
 
 #include "types.h"
 #include "TA.h"
+#include "DataStore.hh"
 
 #define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console;
                                * it will have an impact on code-size and power consumption. */
@@ -80,7 +81,6 @@
 void loop();
 void setup();
 void getRadioInput(char *ibuffer, int size);
-void init_datastore();
 
 #define BLENANO  0  // BLE Nano vs. TA New Baseboard (rev Aug-Nov 2015.)
 
@@ -470,6 +470,11 @@
 
 int main( void )
 {
+    init_datastore();
+    
+    wait_us(400);
+    
+    //is_master = //datastore_is_master();
     Ticker ticker;
 
     ble.init();
@@ -511,7 +516,6 @@
     setup();
     radio_init();
     tmr.start();
-    init_datastore();
     
     int mac_addr = ((int)macAddr[0]);
     mac_addr    |= ((int)macAddr[1] << 8);
@@ -535,12 +539,9 @@
 
         toPhoneChk();  
 
-        if (is_master)
-        {
-            int bytes = MIN( MAX_LEN, phoneP->readable() );
-            getRadioInput( phoneToDev, phoneP->read( phoneToDev, bytes, 1 ) );
-        }
-
+        int bytes = MIN( MAX_LEN, phoneP->readable() );
+        getRadioInput( phoneToDev, phoneP->read( phoneToDev, bytes, 1 ) );
+        
         loop();
         radio_loop(mac_addr);
     }