mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
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 f1da6a4f5f555d4db50b47fb68ce74ae7737b8af. * 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>
This commit is contained in:
@@ -127,6 +127,7 @@ struct OnroadEvent @0xc4fa6047f024e718 {
|
||||
espActive @90;
|
||||
personalityChanged @91;
|
||||
aeb @92;
|
||||
userFlag @95;
|
||||
|
||||
soundsUnavailableDEPRECATED @47;
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
# causing the connection to the panda to be lost
|
||||
EventName.usbError: {
|
||||
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"),
|
||||
},
|
||||
|
||||
@@ -982,6 +982,9 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
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',
|
||||
'carOutput', 'driverMonitoringState', 'longitudinalPlan', 'livePose', 'liveDelay',
|
||||
'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters',
|
||||
'controlsState', 'carControl', 'driverAssistance', 'alertDebug'] + \
|
||||
'controlsState', 'carControl', 'driverAssistance', 'alertDebug', 'userFlag'] + \
|
||||
self.camera_packets + self.sensor_packets + self.gps_packets,
|
||||
ignore_alive=ignore, ignore_avg_freq=ignore,
|
||||
ignore_valid=ignore, frequency=int(1/DT_CTRL))
|
||||
@@ -159,7 +159,11 @@ class SelfdriveD:
|
||||
self.events.add(EventName.selfdriveInitializing)
|
||||
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:
|
||||
return
|
||||
|
||||
@@ -365,7 +369,7 @@ class SelfdriveD:
|
||||
if self.sm['modelV2'].frameDropPerc > 20:
|
||||
self.events.add(EventName.modeldLagging)
|
||||
|
||||
# decrement personality on distance button press
|
||||
# Decrement personality on distance button press
|
||||
if self.CP.openpilotLongitudinalControl:
|
||||
if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents):
|
||||
self.personality = (self.personality - 1) % 3
|
||||
|
||||
Reference in New Issue
Block a user