mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-05 22:05:42 +08:00
MADS: Honda: Fix PCM ACC disengage fault (#363)
* MADS: Honda: Fix PCM ACC disengage fault * try this out * honda only
This commit is contained in:
@@ -282,21 +282,26 @@ class CarInterface(CarInterfaceBase):
|
||||
else:
|
||||
self.CS.madsEnabled = False
|
||||
|
||||
if not self.CP.pcmCruise or (self.CP.pcmCruise and self.CP.minEnableSpeed > 0) or not self.CP.pcmCruiseSpeed:
|
||||
min_enable_speed_pcm = self.CP.pcmCruise and self.CP.minEnableSpeed > 0 and self.CP.pcmCruiseSpeed
|
||||
|
||||
if not self.CP.pcmCruise or min_enable_speed_pcm or not self.CP.pcmCruiseSpeed:
|
||||
if any(b.type == ButtonType.cancel for b in self.CS.button_events):
|
||||
self.CS.madsEnabled, self.CS.accEnabled = self.get_sp_cancel_cruise_state(self.CS.madsEnabled)
|
||||
if self.get_sp_pedal_disengage(ret):
|
||||
self.CS.madsEnabled, self.CS.accEnabled = self.get_sp_cancel_cruise_state(self.CS.madsEnabled)
|
||||
ret.cruiseState.enabled = ret.cruiseState.enabled if not self.enable_mads else False if self.CP.pcmCruise else self.CS.accEnabled
|
||||
ret.cruiseState.enabled = ret.cruiseState.enabled if not self.enable_mads or min_enable_speed_pcm \
|
||||
else False if self.CP.pcmCruise \
|
||||
else self.CS.accEnabled
|
||||
|
||||
if self.CP.pcmCruise and self.CP.minEnableSpeed > 0 and self.CP.pcmCruiseSpeed:
|
||||
if min_enable_speed_pcm:
|
||||
if ret.gasPressed and not ret.cruiseState.enabled:
|
||||
self.CS.accEnabled = False
|
||||
self.CS.accEnabled = ret.cruiseState.enabled or self.CS.accEnabled
|
||||
if ret.cruiseState.enabled and not self.CS.out.cruiseState.enabled:
|
||||
self.CS.accEnabled = True
|
||||
elif not ret.cruiseState.enabled:
|
||||
self.CS.accEnabled = False
|
||||
|
||||
ret, self.CS = self.get_sp_common_state(ret, self.CS,
|
||||
min_enable_speed_pcm=(self.CP.pcmCruise and self.CP.minEnableSpeed > 0 and self.CP.pcmCruiseSpeed),
|
||||
gap_button=(self.CS.cruise_setting == 3))
|
||||
ret, self.CS = self.get_sp_common_state(ret, self.CS, gap_button=(self.CS.cruise_setting == 3))
|
||||
|
||||
ret.buttonEvents = [
|
||||
*self.CS.button_events,
|
||||
|
||||
@@ -615,9 +615,8 @@ class CarInterfaceBase(ABC):
|
||||
else:
|
||||
return CS.madsEnabled
|
||||
|
||||
def get_sp_common_state(self, cs_out, CS, min_enable_speed_pcm=False, gear_allowed=True, gap_button=False):
|
||||
cs_out.cruiseState.enabled = CS.accEnabled if not self.CP.pcmCruise or not self.CP.pcmCruiseSpeed or min_enable_speed_pcm else \
|
||||
cs_out.cruiseState.enabled
|
||||
def get_sp_common_state(self, cs_out, CS, gear_allowed=True, gap_button=False):
|
||||
cs_out.cruiseState.enabled = CS.accEnabled if not self.CP.pcmCruise or not self.CP.pcmCruiseSpeed else cs_out.cruiseState.enabled
|
||||
|
||||
if not self.enable_mads:
|
||||
if cs_out.cruiseState.enabled and not CS.out.cruiseState.enabled:
|
||||
|
||||
@@ -739,7 +739,9 @@ class Controls:
|
||||
CC.angularVelocity = angular_rate_value
|
||||
|
||||
CC.cruiseControl.override = self.enabled_long and not CC.longActive and self.CP.openpilotLongitudinalControl
|
||||
CC.cruiseControl.cancel = CS.cruiseState.enabled and (not self.enabled_long or (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)))
|
||||
CC.cruiseControl.cancel = CS.cruiseState.enabled and \
|
||||
(not self.enabled_long or (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) or
|
||||
(any(b.type == ButtonType.cancel for b in CS.buttonEvents) and self.CP.carName == "honda"))
|
||||
if self.joystick_mode and self.sm.recv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
|
||||
CC.cruiseControl.cancel = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user