diff --git a/cereal/log.capnp b/cereal/log.capnp index 7b6076311f..1228b4a907 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -58,6 +58,7 @@ struct OnroadEvent @0xc4fa6047f024e718 { controlsMismatch @22; pcmEnable @23; pcmDisable @24; + cancellingCruise @24; radarFault @25; radarTempUnavailable @93; brakeHold @26; diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index ee2c418b6e..c24e817dcb 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -646,6 +646,10 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage), }, + EventName.cancellingCruise: { + ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage), + }, + EventName.buttonCancel: { ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage), ET.NO_ENTRY: NoEntryAlert("Cancel Pressed"), diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index c7320f9350..5333f5f584 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -158,6 +158,9 @@ class SelfdriveD: if self.CP.passive: return + if self.sm['carControl'].cruiseControl.cancel: + self.events.add(EventName.cancellingCruise) + # Block resume if cruise never previously enabled resume_pressed = any(be.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for be in CS.buttonEvents) if not self.CP.pcmCruise and CS.vCruise > 250 and resume_pressed: