Block entry on non-adaptive cruise mode (#1708)

* block entry on non-adaptive cruise mode

* user disable

* toyota
albatross
Adeeb Shihadeh 2020-06-15 18:11:50 -07:00 committed by GitHub
parent ed7e568b70
commit 25688f36cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -107,6 +107,8 @@ class CarInterfaceBase():
events.add(EventName.stockAeb)
if cs_out.vEgo > MAX_CTRL_SPEED:
events.add(EventName.speedTooHigh)
if cs_out.cruiseState.nonAdaptive:
events.add(EventName.wrongCruiseMode)
if cs_out.steerError:
events.add(EventName.steerUnavailable)

View File

@ -90,6 +90,8 @@ class CarState(CarStateBase):
else:
ret.cruiseState.standstill = self.pcm_acc_status == 7
ret.cruiseState.enabled = bool(cp.vl["PCM_CRUISE"]['CRUISE_ACTIVE'])
# TODO: CRUISE_STATE is a 4 bit signal, find any other non-adaptive cruise states
ret.cruiseState.nonAdaptive = cp.vl["PCM_CRUISE"]['CRUISE_STATE'] in [5]
if self.CP.carFingerprint == CAR.PRIUS:
ret.genericToggle = cp.vl["AUTOPARK_STATUS"]['STATE'] != 0

View File

@ -189,7 +189,6 @@ EVENTS = {
EventName.gasPressed: {ET.PRE_ENABLE: None},
EventName.wrongCruiseMode: {},
EventName.laneChangeBlocked: {},
EventName.focusRecoverActive: {},
@ -485,6 +484,11 @@ EVENTS = {
duration_hud_alert=0.),
},
EventName.wrongCruiseMode: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.chimeDisengage),
ET.NO_ENTRY: NoEntryAlert("Enable Adaptive Cruise"),
},
EventName.steerTempUnavailable: {
ET.WARNING: Alert(
"TAKE CONTROL",