first commit

Dependencies:   mbed MMA8451Q

Revision:
23:4c743746533c
Parent:
20:7dcdadbd7bc0
Child:
25:8bd029d58251
--- a/state_control.h	Wed Nov 03 16:13:02 2021 +0000
+++ b/state_control.h	Wed Nov 03 21:52:00 2021 +0000
@@ -85,7 +85,7 @@
     batteryVoltage = battInput * 3.3 * battDividerScalar;
     avgCellVoltage = batteryVoltage / 3.0;
     
-    if (left_distance_sensor.read() < (0.700/3.3) && right_distance_sensor.read()*3.3 < (0.700/3.3))
+    if (left_distance_sensor.read() < (0.600/3.3) && right_distance_sensor.read()*3.3 < (0.600/3.3))
         {
           _fault = true;
           fault_type = OFF_TRACK;
@@ -95,37 +95,12 @@
     if (avgCellVoltage <= 3.4){
          _fault = true;
          fault_type = LOW_VOLTAGE;
-         }
-         
-         
-     if (abs(acc.getAccX() > 1.48)){ // was 1.5
-             _fault = true;
-             fault_type = COLLISION;
-             }    
+         }      
+    if (abs(acc.getAccX() > 1.48)){ // was 1.5
+            _fault = true;
+            fault_type = COLLISION;
+        }    
                  
-   
-   /* else {                         //we should only set _fault to false when the user manually clears a fault w a button
-        _fault = false; 
-        fault_type = CLEAR;
-        };
-              
-             
-         /*
-    else if (hit something){
-             
-             _fault = true; 
-             fault_type = BUMPER;
-         } 
-     
-    else if(low battery)
-         _fault = true;
-         fault_type = LOW_VOLTAGE;
-    else {
-        _faule =false; 
-        fault_type = CLEAR;
-        };
-    */
-    //_fault=true;
     
     state_update();
     };