fixed double speed ref in safety files
@@ -12,14 +12,14 @@ int gas_interceptor_detected = 0;
int brake_prev = 0;
int gas_prev = 0;
int gas_interceptor_prev = 0;
-int speed = 0;
+int ego_speed = 0;
static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// sample speed
if ((to_push->RIR>>21) == 0x158) {
// first 2 bytes
- speed = to_push->RDLR & 0xFFFF;
+ ego_speed = to_push->RDLR & 0xFFFF;
}
// state machine to enter and exit controls
@@ -38,7 +38,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((to_push->RIR>>21) == 0x17C) {
// bit 53
int brake = to_push->RDHR & 0x200000;
- if (brake && (!(brake_prev) || speed)) {
+ if (brake && (!(brake_prev) || ego_speed)) {
controls_allowed = 0;
}
brake_prev = brake;
@@ -76,7 +76,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// disallow actuator commands if gas or brake (with vehicle moving) are pressed
// and the the latching controls_allowed flag is True
- int pedal_pressed = gas_prev || gas_interceptor_prev || (brake_prev && speed);
+ int pedal_pressed = gas_prev || gas_interceptor_prev || (brake_prev && ego_speed);
int current_controls_allowed = controls_allowed && !(pedal_pressed);
// BRAKE: safety check
