mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-15 22:32:11 +08:00
Louder blindspot alert
Added toggle to enable a louder alert when a vehicle is detected in your blindspot when changing lanes.
This commit is contained in:
@@ -122,6 +122,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
goatSteerSaturated @125;
|
||||
greenLight @126;
|
||||
holidayActive @127;
|
||||
laneChangeBlockedLoud @128;
|
||||
leadDeparting @129;
|
||||
|
||||
radarCanErrorDEPRECATED @15;
|
||||
|
||||
@@ -297,6 +297,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"LockDoors", PERSISTENT},
|
||||
{"LongitudinalTune", PERSISTENT},
|
||||
{"LongPitch", PERSISTENT},
|
||||
{"LoudBlindspotAlert", PERSISTENT},
|
||||
{"LowVoltageShutdown", PERSISTENT},
|
||||
{"ManualUpdateInitiated", PERSISTENT},
|
||||
{"ModelUI", PERSISTENT},
|
||||
|
||||
@@ -292,7 +292,10 @@ class Controls:
|
||||
direction = self.sm['modelV2'].meta.laneChangeDirection
|
||||
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
|
||||
(CS.rightBlindspot and direction == LaneChangeDirection.right):
|
||||
self.events.add(EventName.laneChangeBlocked)
|
||||
if self.loud_blindspot_alert:
|
||||
self.events.add(EventName.laneChangeBlockedLoud)
|
||||
else:
|
||||
self.events.add(EventName.laneChangeBlocked)
|
||||
else:
|
||||
if direction == LaneChangeDirection.left:
|
||||
self.events.add(EventName.preLaneChangeLeft)
|
||||
@@ -967,6 +970,7 @@ class Controls:
|
||||
custom_alerts = self.params.get_bool("CustomAlerts")
|
||||
self.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
|
||||
self.lead_departing_alert = custom_alerts and self.params.get_bool("LeadDepartingAlert")
|
||||
self.loud_blindspot_alert = custom_alerts and self.params.get_bool("LoudBlindspotAlert")
|
||||
|
||||
custom_theme = self.params.get_bool("CustomTheme")
|
||||
custom_sounds = self.params.get_int("CustomSounds") if custom_theme else 0
|
||||
|
||||
@@ -1011,6 +1011,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
ET.PERMANENT: holiday_alert,
|
||||
},
|
||||
|
||||
EventName.laneChangeBlockedLoud: {
|
||||
ET.WARNING: Alert(
|
||||
"Car Detected in Blindspot",
|
||||
"",
|
||||
AlertStatus.userPrompt, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.warningSoft, .1),
|
||||
},
|
||||
|
||||
EventName.leadDeparting: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Lead departed",
|
||||
|
||||
@@ -17,6 +17,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
{"CustomAlerts", tr("Custom Alerts"), tr("Enable custom alerts for openpilot events."), "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
||||
{"GreenLightAlert", tr("Green Light Alert"), tr("Get an alert when a traffic light changes from red to green."), ""},
|
||||
{"LeadDepartingAlert", tr("Lead Departing Alert"), tr("Get an alert when the lead vehicle starts departing when at a standstill."), ""},
|
||||
{"LoudBlindspotAlert", tr("Loud Blindspot Alert"), tr("Enable a louder alert for when a vehicle is detected in the blindspot when attempting to change lanes."), ""},
|
||||
|
||||
{"CustomUI", tr("Custom Onroad UI"), tr("Customize the Onroad UI."), "../assets/offroad/icon_road.png"},
|
||||
{"DeveloperUI", tr("Developer UI"), tr("Get various detailed information of what openpilot is doing behind the scenes."), ""},
|
||||
@@ -73,6 +74,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
std::set<QString> modifiedCustomAlertsKeys = customAlertsKeys;
|
||||
|
||||
if (!hasBSM) {
|
||||
modifiedCustomAlertsKeys.erase("LoudBlindspotAlert");
|
||||
}
|
||||
|
||||
toggle->setVisible(modifiedCustomAlertsKeys.find(key.c_str()) != modifiedCustomAlertsKeys.end());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ private:
|
||||
void updateToggles();
|
||||
|
||||
std::set<QString> alertVolumeControlKeys = {"DisengageVolume", "EngageVolume", "PromptDistractedVolume", "PromptVolume", "RefuseVolume", "WarningImmediateVolume", "WarningSoftVolume"};
|
||||
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert"};
|
||||
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert"};
|
||||
std::set<QString> customOnroadUIKeys = {"CustomPaths", "DeveloperUI", "FPSCounter", "LeadInfo"};
|
||||
std::set<QString> customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "HolidayThemes"};
|
||||
std::set<QString> modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
||||
|
||||
Reference in New Issue
Block a user