ui: show alert when user flag (bookmark) pressed (#34920)

* feat: Show alert on user flag event

* feat: Temporarily update border status on user flag to match connect timeline

* Revert "feat: Temporarily update border status on user flag to match connect timeline"

This reverts commit f1da6a4f5f.

* feat: Increase alert duration to 1.5 seconds

* remove audible alert for bookmark event

* refactor: Use NormalPermamentAlert for user flag alert

* fix: Update userFlag enum value in OnroadEvent struct

* fix: Handle userFlag event even in dashcam mode

* don't need to ignore that anymore

* remove 'userFlag' from ignore list

---------

Co-authored-by: Jason Young <jyoung8607@gmail.com>
pull/35169/head
David 2 weeks ago committed by GitHub
parent 1f312e16d4
commit 32167e02c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      cereal/log.capnp
  2. 5
      selfdrive/selfdrived/events.py
  3. 10
      selfdrive/selfdrived/selfdrived.py

@ -127,6 +127,7 @@ struct OnroadEvent @0xc4fa6047f024e718 {
espActive @90; espActive @90;
personalityChanged @91; personalityChanged @91;
aeb @92; aeb @92;
userFlag @95;
soundsUnavailableDEPRECATED @47; soundsUnavailableDEPRECATED @47;
} }

@ -894,7 +894,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
# causing the connection to the panda to be lost # causing the connection to the panda to be lost
EventName.usbError: { EventName.usbError: {
ET.SOFT_DISABLE: soft_disable_alert("USB Error: Reboot Your Device"), ET.SOFT_DISABLE: soft_disable_alert("USB Error: Reboot Your Device"),
ET.PERMANENT: NormalPermanentAlert("USB Error: Reboot Your Device", ""), ET.PERMANENT: NormalPermanentAlert("USB Error: Reboot Your Device"),
ET.NO_ENTRY: NoEntryAlert("USB Error: Reboot Your Device"), ET.NO_ENTRY: NoEntryAlert("USB Error: Reboot Your Device"),
}, },
@ -982,6 +982,9 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.WARNING: personality_changed_alert, ET.WARNING: personality_changed_alert,
}, },
EventName.userFlag: {
ET.PERMANENT: NormalPermanentAlert("Bookmark Saved", duration=1.5),
},
} }

@ -77,7 +77,7 @@ class SelfdriveD:
self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration', self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration',
'carOutput', 'driverMonitoringState', 'longitudinalPlan', 'livePose', 'liveDelay', 'carOutput', 'driverMonitoringState', 'longitudinalPlan', 'livePose', 'liveDelay',
'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters', 'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters',
'controlsState', 'carControl', 'driverAssistance', 'alertDebug'] + \ 'controlsState', 'carControl', 'driverAssistance', 'alertDebug', 'userFlag'] + \
self.camera_packets + self.sensor_packets + self.gps_packets, self.camera_packets + self.sensor_packets + self.gps_packets,
ignore_alive=ignore, ignore_avg_freq=ignore, ignore_alive=ignore, ignore_avg_freq=ignore,
ignore_valid=ignore, frequency=int(1/DT_CTRL)) ignore_valid=ignore, frequency=int(1/DT_CTRL))
@ -159,7 +159,11 @@ class SelfdriveD:
self.events.add(EventName.selfdriveInitializing) self.events.add(EventName.selfdriveInitializing)
return return
# no more events while in dashcam mode # Check for user flag (bookmark) press
if self.sm.updated['userFlag']:
self.events.add(EventName.userFlag)
# Don't add any more events while in dashcam mode
if self.CP.passive: if self.CP.passive:
return return
@ -365,7 +369,7 @@ class SelfdriveD:
if self.sm['modelV2'].frameDropPerc > 20: if self.sm['modelV2'].frameDropPerc > 20:
self.events.add(EventName.modeldLagging) self.events.add(EventName.modeldLagging)
# decrement personality on distance button press # Decrement personality on distance button press
if self.CP.openpilotLongitudinalControl: if self.CP.openpilotLongitudinalControl:
if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents): if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents):
self.personality = (self.personality - 1) % 3 self.personality = (self.personality - 1) % 3

Loading…
Cancel
Save