diff --git a/board/safety.h b/board/safety.h index 722ba3994fe030..fd61d6af5249b7 100644 --- a/board/safety.h +++ b/board/safety.h @@ -45,6 +45,7 @@ typedef struct { // This can be set by the safety hooks. int controls_allowed = 0; +int gas_interceptor_detected = 0; // Include the actual safety policies. #include "safety/safety_defaults.h" diff --git a/board/safety/safety_honda.h b/board/safety/safety_honda.h index adaabd5b095c9c..01971e93e7b5c3 100644 --- a/board/safety/safety_honda.h +++ b/board/safety/safety_honda.h @@ -7,9 +7,7 @@ // brake rising edge // brake > 0mph -// these are set in the Honda safety hooks...this is the wrong place const int HONDA_GAS_INTERCEPTOR_THRESHOLD = 328; -int honda_gas_interceptor_detected = 0; int honda_brake_prev = 0; int honda_gas_prev = 0; int honda_gas_interceptor_prev = 0; @@ -58,7 +56,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { // exit controls on rising edge of gas press if interceptor (0x201 w/ len = 6) // length check because bosch hardware also uses this id (0x201 w/ len = 8) if ((to_push->RIR>>21) == 0x201 && (to_push->RDTR & 0xf) == 6) { - honda_gas_interceptor_detected = 1; + gas_interceptor_detected = 1; int gas_interceptor = ((to_push->RDLR & 0xFF) << 8) | ((to_push->RDLR & 0xFF00) >> 8); if ((gas_interceptor > HONDA_GAS_INTERCEPTOR_THRESHOLD) && (honda_gas_interceptor_prev <= HONDA_GAS_INTERCEPTOR_THRESHOLD)) { @@ -68,7 +66,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { } // exit controls on rising edge of gas press if no interceptor - if (!honda_gas_interceptor_detected) { + if (!gas_interceptor_detected) { if ((to_push->RIR>>21) == 0x17C) { int gas = to_push->RDLR & 0xFF; if (gas && !(honda_gas_prev)) { diff --git a/tests/safety/test.c b/tests/safety/test.c index 4632987abb4183..b187662a3d2e70 100644 --- a/tests/safety/test.c +++ b/tests/safety/test.c @@ -233,7 +233,7 @@ void init_tests_subaru(void){ void init_tests_honda(void){ honda_ego_speed = 0; - honda_gas_interceptor_detected = 0; + gas_interceptor_detected = 0; honda_brake_prev = 0; honda_gas_prev = 0; }