Skip to content

Commit f7f899f

Browse files
author
kegman
committed
Bosch Gas Press (commaai#243)
* Disabled gas press disengage for Bosch Honda * Disable gasPressed for Bosch in interface.py * Fix indent for interface.py gasPress Bosch disable * allow gas disengagement for CR-V (commaai#237) * allow disengagement for CR-V (commaai#238) already tested
1 parent 38e9435 commit f7f899f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

panda/board/safety/safety_honda.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bool honda_moving = false;
1818
bool honda_bosch_hardware = false;
1919
bool honda_alt_brake_msg = false;
2020
bool honda_fwd_brake = false;
21+
bool bosch_ACC_allowed = false;
2122

2223
static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
2324

@@ -81,7 +82,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
8182
if (!gas_interceptor_detected) {
8283
if (addr == 0x17C) {
8384
int gas = GET_BYTE(to_push, 0);
84-
if (gas && !(honda_gas_prev) && long_controls_allowed) {
85+
if (gas && !(honda_gas_prev) && long_controls_allowed && !(bosch_ACC_allowed)) {
8586
controls_allowed = 0;
8687
}
8788
honda_gas_prev = gas;
@@ -146,7 +147,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
146147

147148
// disallow actuator commands if gas or brake (with vehicle moving) are pressed
148149
// and the the latching controls_allowed flag is True
149-
int pedal_pressed = honda_gas_prev || (gas_interceptor_prev > HONDA_GAS_INTERCEPTOR_THRESHOLD) ||
150+
int pedal_pressed = (!bosch_ACC_allowed && honda_gas_prev) || (gas_interceptor_prev > HONDA_GAS_INTERCEPTOR_THRESHOLD) ||
150151
(honda_brake_pressed_prev && honda_moving);
151152
bool current_controls_allowed = controls_allowed && !(pedal_pressed);
152153

@@ -168,6 +169,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
168169

169170
// STEER: safety check
170171
if ((addr == 0xE4) || (addr == 0x194)) {
172+
bosch_ACC_allowed = honda_bosch_hardware;
171173
if (!current_controls_allowed) {
172174
bool steer_applied = GET_BYTE(to_send, 0) | GET_BYTE(to_send, 1);
173175
if (steer_applied) {
@@ -179,7 +181,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
179181
// GAS: safety check
180182
if (addr == 0x200) {
181183
if (!current_controls_allowed || !long_controls_allowed) {
182-
if (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1)) {
184+
if (!bosch_ACC_allowed && (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1))) {
183185
tx = 0;
184186
}
185187
}

selfdrive/car/honda/interface.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ def __init__(self, CP, CarController):
9797
self.compute_gb = get_compute_gb_acura()
9898
else:
9999
self.compute_gb = compute_gb_honda
100+
101+
if self.CS.CP.carFingerprint in HONDA_BOSCH:
102+
self.bosch_honda = True
103+
else:
104+
self.bosch_honda = False
100105

101106
@staticmethod
102107
def calc_accel_override(a_ego, a_target, v_ego, v_target):
@@ -545,11 +550,11 @@ def update(self, c, can_strings):
545550
events.append(create_event('speedTooLow', [ET.NO_ENTRY]))
546551

547552
# disable on pedals rising edge or when brake is pressed and speed isn't zero
548-
if (ret.gasPressed and not self.gas_pressed_prev) or \
553+
if (ret.gasPressed and not self.gas_pressed_prev and not self.bosch_honda) or \
549554
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
550555
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
551556

552-
if ret.gasPressed:
557+
if ret.gasPressed and not self.bosch_honda:
553558
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
554559

555560
# it can happen that car cruise disables while comma system is enabled: need to

0 commit comments

Comments
 (0)