football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
28:8e74ddc4f70f
Parent:
24:ff54dec20f55
Child:
30:c60b0d52b067
--- a/main.cpp	Thu Dec 31 17:47:15 2015 +0000
+++ b/main.cpp	Sun Jan 03 20:05:15 2016 +0000
@@ -192,7 +192,12 @@
 
     // Get MAC addr so we can create a device name using it.
     ble.getAddress( pAdType, macAddr );
-    sprintf( deviceName, "T%02X%02X", macAddr[1], macAddr[0] );
+    
+    #ifdef MASTER
+    sprintf( deviceName, "M%02X%02X", macAddr[1], macAddr[0] );
+    #else
+    sprintf( deviceName, "S%02X%02X", macAddr[1], macAddr[0] );
+    #endif
 
     ble.accumulateAdvertisingPayload( GapAdvertisingData::COMPLETE_LOCAL_NAME,
                                       (const uint8_t *)deviceName, strlen(deviceName) );
@@ -425,7 +430,7 @@
         }
     }
 }
-/*
+
 static uint32_t boot_cnt_data = 0;
 static uint16_t data_block    = 9*20 +75;   // Last block -- Use for app-start count.
 static uint16_t data_size     = 4;
@@ -547,7 +552,7 @@
 
     return  pstorage_register( &pstorage_param, &pstorage_id );
 }
-*/
+
 
 void periodicCallback( void )
 {
@@ -588,7 +593,7 @@
   /*
     // Thread thread( led_thread );
   */
-
+    
  /////pcfc.baud( 57600 );
 
   /*
@@ -617,18 +622,21 @@
     uint32_t pstorageErr = pstorage_init();  // This needs to be called, even though apparently called in bootloader--Check other stuff.
     pstorage_access_status_get( &p_count );
 
-  /*
+  
 //    pcfc.printf( "\r\nInitial pstorage count: %d\r\n", p_count );
 
-    if( NRF_SUCCESS != pstorageErr )  pcfc.printf( "\r\nWarn: pstorage init error: %x\r\n", pstorageErr );
+    if( NRF_SUCCESS != pstorageErr )
+    {
+      writeToPhone( "\r\nWarn: pstorage init error: %x\r\n", pstorageErr );
+    }
       else
       {
           pstorageErr = pstorage_setup();
-          if( NRF_SUCCESS != pstorageErr )  pcfc.printf( "\r\nWarn: pstorage setup error: %x\r\n", pstorageErr );
+          if( NRF_SUCCESS != pstorageErr )  writeToPhone( "\r\nWarn: pstorage setup error: %x\r\n", pstorageErr );
             else
             {
                 pstorageErr = pstorage_read_test();
-                if( NRF_SUCCESS != pstorageErr )  pcfc.printf( "\r\nWarn: pstorage read attempt error: %x\r\n", pstorageErr );
+                if( NRF_SUCCESS != pstorageErr )  writeToPhone( "\r\nWarn: pstorage read attempt error: %x\r\n", pstorageErr );
                   else
                   {
                       // In this test setup, we use the load callback to signal start to clear,
@@ -636,7 +644,7 @@
                   }
             }
       }
-    */
+    
 
     DeviceInformationService deviceInfo( ble, "TRX", "TrueAgility", "SN0001", "hw-rev1", "fw-rev1" );
     BatteryService battService( ble );