diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index db6b75319a..c73aa93847 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -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) diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 1c8c3735d7..02bd893eeb 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -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 diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index db36fe99ca..7d1895e038 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -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",