Bayley Wang / Mbed 2 deprecated foc-ed_in_the_bot_compact

Dependencies:   FastPWM3 mbed

Revision:
188:43f50a4cc040
Parent:
187:523cf8c962e4
Child:
189:760cd81a7633
--- a/BREMS/BREMSConfig.cpp	Fri Feb 09 23:24:25 2018 +0000
+++ b/BREMS/BREMSConfig.cpp	Sat Feb 10 00:13:04 2018 +0000
@@ -99,21 +99,21 @@
     io->pc = new Serial(USBTX, USBRX);
     io->pc->baud(115200);
     
-    io->pos = new PositionSensorEncoder(CPR, 0);
-    io->logger = new BufferedLogger(LOG_PACKET_SIZE, (LOG_PAGE_SIZE-LOG_HEADER_SIZE)/(LOG_PACKET_SIZE+1), LOG_TX, LOG_RX, LOG_BAUD_RATE);
-    io->pref = new PreferenceWriter(6);
-
-    wait_ms(750);
-    
     BREMSStartupMsg(read, io->pc);
 
+    io->pref = new PreferenceWriter(6);
     cmd_reload(io->pc, io->pref);
     if (_PREFS_VALID != 1) {
         io->pc->printf("%s\n", "Stored config invalid");
         cmd_defaults(io->pc);
         io->pc->printf("%s\n", "You should probably at least set throttle and current limits!");
     }
-            
+    
+    io->pos = new PositionSensorEncoder(CPR, 0);
+    io->logger = new BufferedLogger(LOG_PACKET_SIZE, (LOG_PAGE_SIZE-LOG_HEADER_SIZE)/(LOG_PACKET_SIZE+1), LOG_TX, LOG_RX, LOG_BAUD_RATE);
+
+    wait_ms(750);
+                
     io->throttle_in = new PwmIn(TH_PIN, TH_LIMIT_LOW, TH_LIMIT_HIGH);
     
     control->throttle_filter = new MedianFilter(THROTTLE_FILTER_WINDOW);