
first commit
Diff: state_control.h
- Revision:
- 7:05ea1c004b49
- Parent:
- 6:d2bd68ba99c9
- Child:
- 9:5320c2dfb913
--- a/state_control.h Mon Oct 25 03:15:51 2021 +0000 +++ b/state_control.h Mon Oct 25 16:48:20 2021 +0000 @@ -72,25 +72,22 @@ enum fault_list {CLEAR,OFF_TRACK, BUMPER, LOW_VOLTAGE}; fault_list fault_type=CLEAR; void fault_check(void){ + batteryVoltage = battInput * 3.3 * battDividerScalar; + avgCellVoltage = batteryVoltage / 3.0; if (left_distance_sensor.read()*3.3 < 0.700 && right_distance_sensor.read()*3.3 < 0.700) { _fault = true; fault_type = OFF_TRACK; } - else { //we should only set _fault to false when the user manually clears a fault w a button - _fault = false; - fault_type = CLEAR; - } - - - -batteryVoltage = battInput * 3.3 * battDividerScalar; -avgCellVoltage = batteryVoltage / 3.0; - - if (avgCellVoltage <= 3.4){ + else if (avgCellVoltage <= 3.4){ _fault = true; fault_type = LOW_VOLTAGE; } + 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){