Skip to content

Commit

Permalink
add fault invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Mar 13, 2018
1 parent 2c26e45 commit 11c2b08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion board/pedal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ uint32_t current_index = 0;
#define FAULT_SCE 3
#define FAULT_STARTUP 4
#define FAULT_TIMEOUT 5
#define FAULT_INVALID 6
uint8_t state = FAULT_STARTUP;

void CAN1_RX0_IRQHandler() {
Expand Down Expand Up @@ -151,7 +152,11 @@ void CAN1_RX0_IRQHandler() {
gas_set_1 = value_1;
} else {
// clear the fault state if values are 0
if (value_0 == 0 && value_1 == 0) state = NO_FAULT;
if (value_0 == 0 && value_1 == 0) {
state = NO_FAULT;
} else {
state = FAULT_INVALID;
}
gas_set_0 = gas_set_1 = 0;
}
// clear the timeout
Expand Down

0 comments on commit 11c2b08

Please sign in to comment.