From 11c2b08c2f7346a725fa5e0298b50f409e172cca Mon Sep 17 00:00:00 2001 From: George Hotz Date: Mon, 12 Mar 2018 19:56:57 -0700 Subject: [PATCH] add fault invalid --- board/pedal/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/board/pedal/main.c b/board/pedal/main.c index 5b0ce4cc0701ec..5d5264791ccf54 100644 --- a/board/pedal/main.c +++ b/board/pedal/main.c @@ -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() { @@ -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