
first commit
Diff: state_control.h
- Revision:
- 20:7dcdadbd7bc0
- Parent:
- 19:65fecaa2a387
- Child:
- 23:4c743746533c
--- a/state_control.h Thu Oct 28 00:28:29 2021 +0000 +++ b/state_control.h Thu Oct 28 21:41:03 2021 +0000 @@ -80,24 +80,29 @@ } void fault_check(void){ - _fault = false; + _fault = false; fault_type = CLEAR; 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)) { _fault = true; fault_type = OFF_TRACK; } + + if (avgCellVoltage <= 3.4){ _fault = true; fault_type = LOW_VOLTAGE; } - if (abs(acc.getAccX() > 1.5)){ + + 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;