diff --git a/panda/board/safety/safety_gm.h b/panda/board/safety/safety_gm.h index 8672cc267..792bcb808 100644 --- a/panda/board/safety/safety_gm.h +++ b/panda/board/safety/safety_gm.h @@ -92,7 +92,7 @@ static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (addr == 417) { bool gas_pressed = GET_BYTE(to_push, 6) != 0; if (gas_pressed && !gas_pressed_prev) { - controls_allowed = 0; + controls_allowed = 1; } gas_pressed_prev = gas_pressed; } @@ -138,7 +138,8 @@ static int gm_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_pressed_prev || (brake_pressed_prev && gm_moving); + //int pedal_pressed = gas_pressed_prev || (brake_pressed_prev && gm_moving); + int pedal_pressed = brake_pressed_prev && gm_moving; bool current_controls_allowed = controls_allowed && !pedal_pressed; // BRAKE: safety check diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h index 75ecae214..a5e34b84a 100644 --- a/panda/board/safety/safety_honda.h +++ b/panda/board/safety/safety_honda.h @@ -343,4 +343,4 @@ const safety_hooks honda_bosch_harness_hooks = { .fwd = honda_bosch_fwd_hook, .addr_check = honda_bh_rx_checks, .addr_check_len = sizeof(honda_bh_rx_checks) / sizeof(honda_bh_rx_checks[0]), -}; +}; \ No newline at end of file diff --git a/panda/board/safety/safety_hyundai.h b/panda/board/safety/safety_hyundai.h index 1b5b656ff..ab44194fa 100644 --- a/panda/board/safety/safety_hyundai.h +++ b/panda/board/safety/safety_hyundai.h @@ -56,7 +56,7 @@ static int hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (addr == 608) { bool gas_pressed = (GET_BYTE(to_push, 7) >> 6) != 0; if (gas_pressed && !gas_pressed_prev) { - controls_allowed = 0; + controls_allowed = 1; } gas_pressed_prev = gas_pressed; } diff --git a/panda/board/safety/safety_nissan.h b/panda/board/safety/safety_nissan.h index baa82b8d4..b8b4d8fcd 100644 --- a/panda/board/safety/safety_nissan.h +++ b/panda/board/safety/safety_nissan.h @@ -64,7 +64,7 @@ static int nissan_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (addr == 0x15c) { bool gas_pressed = ((GET_BYTE(to_push, 5) << 2) | ((GET_BYTE(to_push, 6) >> 6) & 0x3)); if (gas_pressed && !gas_pressed_prev) { - controls_allowed = 0; + controls_allowed = 1; } gas_pressed_prev = gas_pressed; } diff --git a/panda/board/safety/safety_subaru.h b/panda/board/safety/safety_subaru.h index 9b7665f2b..4b1ddca61 100644 --- a/panda/board/safety/safety_subaru.h +++ b/panda/board/safety/safety_subaru.h @@ -117,7 +117,7 @@ static int subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { int byte = subaru_global ? 4 : 0; bool gas_pressed = GET_BYTE(to_push, byte) != 0; if (gas_pressed && !gas_pressed_prev) { - controls_allowed = 0; + controls_allowed = 1; } gas_pressed_prev = gas_pressed; } diff --git a/panda/board/safety/safety_toyota.h b/panda/board/safety/safety_toyota.h index 0f2842360..048cd87e1 100644 --- a/panda/board/safety/safety_toyota.h +++ b/panda/board/safety/safety_toyota.h @@ -87,7 +87,7 @@ static int toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { // 5th bit is CRUISE_ACTIVE int cruise_engaged = GET_BYTE(to_push, 0) & 0x20; if (!cruise_engaged) { - controls_allowed = 1; + controls_allowed = 0; } if (cruise_engaged && !toyota_cruise_engaged_last) { controls_allowed = 1; @@ -112,7 +112,7 @@ static int toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { int byte = (addr == 0x224) ? 0 : 4; bool brake_pressed = ((GET_BYTE(to_push, byte) >> 5) & 1) != 0; if (brake_pressed && (!brake_pressed_prev || toyota_moving)) { - controls_allowed = 1; + controls_allowed = 0; } brake_pressed_prev = brake_pressed; } @@ -275,4 +275,4 @@ const safety_hooks toyota_hooks = { .fwd = toyota_fwd_hook, .addr_check = toyota_rx_checks, .addr_check_len = sizeof(toyota_rx_checks)/sizeof(toyota_rx_checks[0]), -}; +}; \ No newline at end of file diff --git a/panda/board/safety/safety_volkswagen.h b/panda/board/safety/safety_volkswagen.h index 132c10d11..5e4282786 100644 --- a/panda/board/safety/safety_volkswagen.h +++ b/panda/board/safety/safety_volkswagen.h @@ -137,7 +137,7 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (addr == MSG_MOTOR_20) { bool gas_pressed = ((GET_BYTES_04(to_push) >> 12) & 0xFF) != 0; if (gas_pressed && !gas_pressed_prev) { - controls_allowed = 0; + controls_allowed = 1; } gas_pressed_prev = gas_pressed; } diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 57e416407..ed516759e 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -136,6 +136,8 @@ class CarState(CarStateBase): enable_acc = False if ret.seatbeltUnlatched or ret.doorOpen: enable_acc = False + if ret.brakePressed: + enable_acc = False ret.cruiseState.enabled = enable_acc return ret