修正 toyota d_allowGasOnOP,移除 panda 檢測 gas/brake

This commit is contained in:
Rick Lan
2019-07-02 10:02:52 +10:00
parent b079fa23a6
commit d79c10c022
2 changed files with 26 additions and 25 deletions
+20 -20
View File
@@ -61,26 +61,26 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
toyota_cruise_engaged_last = cruise_engaged;
}
// exit controls on rising edge of gas press if interceptor (0x201)
if ((to_push->RIR>>21) == 0x201) {
gas_interceptor_detected = 1;
int gas_interceptor = ((to_push->RDLR & 0xFF) << 8) | ((to_push->RDLR & 0xFF00) >> 8);
if ((gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
(gas_interceptor_prev <= TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
long_controls_allowed) {
controls_allowed = 0;
}
gas_interceptor_prev = gas_interceptor;
}
// exit controls on rising edge of gas press
if ((to_push->RIR>>21) == 0x2C1) {
int gas = (to_push->RDHR >> 16) & 0xFF;
if ((gas > 0) && (toyota_gas_prev == 0) && !gas_interceptor_detected && long_controls_allowed) {
controls_allowed = 0;
}
toyota_gas_prev = gas;
}
// // exit controls on rising edge of gas press if interceptor (0x201)
// if ((to_push->RIR>>21) == 0x201) {
// gas_interceptor_detected = 1;
// int gas_interceptor = ((to_push->RDLR & 0xFF) << 8) | ((to_push->RDLR & 0xFF00) >> 8);
// if ((gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
// (gas_interceptor_prev <= TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
// long_controls_allowed) {
// controls_allowed = 0;
// }
// gas_interceptor_prev = gas_interceptor;
// }
//
// // exit controls on rising edge of gas press
// if ((to_push->RIR>>21) == 0x2C1) {
// int gas = (to_push->RDHR >> 16) & 0xFF;
// if ((gas > 0) && (toyota_gas_prev == 0) && !gas_interceptor_detected && long_controls_allowed) {
// controls_allowed = 0;
// }
// toyota_gas_prev = gas;
// }
int bus = (to_push->RDTR >> 4) & 0xF;
// msgs are only on bus 2 if panda is connected to frc
+6 -5
View File
@@ -374,15 +374,16 @@ class CarInterface(object):
# while in standstill, send a user alert
events.append(create_event('manualRestart', [ET.WARNING]))
# enable request in prius is simple, as we activate when Toyota is active (rising edge)
if ret.cruiseState.enabled and not self.cruise_enabled_prev:
events.append(create_event('pcmEnable', [ET.ENABLE]))
elif not ret.cruiseState.enabled:
events.append(create_event('pcmDisable', [ET.USER_DISABLE]))
if ret.gasPressed and not self.gas_pressed_prev and params.get("d_allowGasOnOP") == "0":
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
if ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001):
events.append(create_event('pcmDisable', [ET.USER_DISABLE]))
# disable on pedals rising edge or when brake is pressed and speed isn't zero
if (ret.gasPressed and not self.gas_pressed_prev) or \
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
if ret.gasPressed and params.get("d_allowGasOnOP") == "0":