Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
KoenKahlman
Date:
Thu Jun 27 09:26:40 2019 +0000
Parent:
2:bb96eba66e78
Commit message:
ignores power surge on startup

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r bb96eba66e78 -r 7cfbf73d6809 main.cpp
--- a/main.cpp	Thu Jun 27 08:58:49 2019 +0000
+++ b/main.cpp	Thu Jun 27 09:26:40 2019 +0000
@@ -143,6 +143,17 @@
         enable = true;
         initSwitches(); //put switches in starting position
         wait_ms(2000); //power surge safety
+        if(int0flag || int1flag){
+            pc.printf("WARNING: Initialization power surge! Sensor ignored\n\r"); 
+            if(int0flag){
+                int trash = mcp->_read(INTCAPA);
+                int0flag = false;
+            }
+            if(int1flag){
+                int trash = mcp->_read(INTCAPB);
+                int1flag = false;
+            }  
+        }
         
         if(!test){
             iter = 0; //iter count   
@@ -240,8 +251,8 @@
 
 void startupWait(){
     lcd.cls();
-    lcd.printf("Press START to start");
-    pc.printf("Press START to start\n\r");  
+    lcd.printf("Press START when ready");
+    pc.printf("Press START when ready. Starting position: train 1 between marker 1 and 2, train 2 between marker 6 and 7.\n\r");  
     while(button3){
         //do nothing   
     }