Main Program

Dependencies:   mbed AQM1602 HMC6352 PID

Revision:
27:769cb5a7ea37
Parent:
26:fbb03281fc7d
Child:
28:8ac6c3c1e643
--- a/main_processing/setup_command_active/command.cpp	Sun Jan 31 06:53:54 2016 +0000
+++ b/main_processing/setup_command_active/command.cpp	Sun Jan 31 15:46:19 2016 +0000
@@ -28,6 +28,10 @@
             if(x!=0){
                 z = (*Function[y])(x);
                 if(z==1){
+                    if((x!=0)&&(data.init_point_flag==1)){
+                       data.init_point_flag=0;
+                       y = 1;
+                    }
                     x=0;
                     Lcd.cls();
                     Lcd.locate(0, 0);
@@ -98,7 +102,7 @@
 }
 uint8_t LoopFunction3(uint8_t x){
     char buf[0x10];
-    sprintf(buf, "A:%1d B:%1d C:%1d ", Line[2].read(), Line[1].read(), Line[0].read());
+    sprintf(buf, "A:%1d B:%1d C:%1d ", Line[0].read(), Line[1].read(), Line[2].read());
     Lcd.locate(0, 1);Lcd.print(buf);wait_ms(50);return 0;
 }
 uint8_t LoopFunction4(uint8_t x){
@@ -121,10 +125,29 @@
     hmc.setCalibrationMode(HMC6352_ENTER_CALIB);
     return 1;
 }
-uint8_t LoopFunction7(uint8_t x){ return 0; }
+uint8_t LoopFunction7(uint8_t x){
+    char buf[0x10];
+    data.init_point_flag=1;
+    sprintf(buf, "FaceToFront!");
+    Lcd.locate(0, 1);Lcd.print(buf);
+    for(int i=0; i<5; i++){
+        ReadCmps();
+        data.CmpsInitialValue = data.cmps;
+        wait_ms(100);
+    }
+    data.CmpsDiff = REFERENCE - data.cmps;
+    data.FrontDeg=0;
+    return 1;
+}
 uint8_t LoopFunction8(uint8_t x){ return 0; }
 uint8_t LoopFunction9(uint8_t x){ return 0; }
-uint8_t LoopFunctionA(uint8_t x){ return 0; }
+uint8_t LoopFunctionA(uint8_t x){
+    char buf[0x10];
+    sprintf(buf, "SeeYouAgain!");
+    Lcd.locate(0, 1);Lcd.print(buf);wait(0.5);
+    NVIC_SystemReset();
+    return 1;
+}
 uint8_t LoopFunctionB(uint8_t x){
     char buf[0x10];
     if(x==1) data.strategy = 6;