mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 17:43:54 +08:00
controls: disengage on regen paddle independently (#26453)
* add regen braking field that's just used to add a pedalPressed
* bump
* bump
* Update ref_commit
* we want the standstill check
we want the standstill check
* see what diff is now
* Update ref_commit
old-commit-hash: 74b6e22a7d
This commit is contained in:
2
cereal
2
cereal
Submodule cereal updated: cdba1aafec...afafa0a2a5
@@ -63,7 +63,7 @@ class CarState(CarStateBase):
|
||||
|
||||
# Regen braking is braking
|
||||
if self.CP.transmissionType == TransmissionType.direct:
|
||||
ret.brakePressed = ret.brakePressed or pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0
|
||||
ret.regenBraking = pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0
|
||||
|
||||
ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254.
|
||||
ret.gasPressed = ret.gas > 1e-5
|
||||
|
||||
@@ -251,8 +251,8 @@ class TestCarModelBase(unittest.TestCase):
|
||||
if CS.brakePressed and not self.safety.get_brake_pressed_prev():
|
||||
if self.CP.carFingerprint in (HONDA.PILOT, HONDA.PASSPORT, HONDA.RIDGELINE) and CS.brake > 0.05:
|
||||
brake_pressed = False
|
||||
safety_brake_pressed = self.safety.get_brake_pressed_prev() or self.safety.get_regen_braking_prev()
|
||||
checks['brakePressed'] += brake_pressed != safety_brake_pressed
|
||||
checks['brakePressed'] += brake_pressed != self.safety.get_brake_pressed_prev()
|
||||
checks['regenBraking'] += CS.regenBraking != self.safety.get_regen_braking_prev()
|
||||
|
||||
if self.CP.pcmCruise:
|
||||
# On most pcmCruise cars, openpilot's state is always tied to the PCM's cruise state.
|
||||
|
||||
@@ -250,7 +250,8 @@ class Controls:
|
||||
|
||||
# Disable on rising edge of accelerator or brake. Also disable on brake when speed > 0
|
||||
if (CS.gasPressed and not self.CS_prev.gasPressed and self.disengage_on_accelerator) or \
|
||||
(CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)):
|
||||
(CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) or \
|
||||
(CS.regenBraking and (not self.CS_prev.regenBraking or not CS.standstill)):
|
||||
self.events.add(EventName.pedalPressed)
|
||||
|
||||
if CS.gasPressed:
|
||||
|
||||
@@ -1 +1 @@
|
||||
a36f7e2fd922fcadca6f8a3d777f4db787cba016
|
||||
9e37e8ee8013515cfd75cf352a1a2b9aa447c441
|
||||
|
||||
Reference in New Issue
Block a user