mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-11 04:12:07 +08:00
Hide the bodies
User can now hide: DM Icon Lane Change Banner Turning Banner Distance Profile Banner
This commit is contained in:
@@ -306,6 +306,10 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"GoatScreamCriticalAlerts", {PERSISTENT, BOOL, "0", "0", 1}},
|
||||
{"GreenLightAlert", {PERSISTENT, BOOL, "0", "0", 0}},
|
||||
{"HideAlerts", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideChangingLanesBanner", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideDistanceProfileBanner", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideTurningBanner", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideDMIcon", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideLeadMarker", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideMaxSpeed", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HideSpeed", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
|
||||
@@ -395,7 +395,23 @@ def longitudinal_maneuver_alert(CP: car.CarParams, CS: car.CarState, sm: messagi
|
||||
Priority.LOW, VisualAlert.none, audible_alert, 0.2)
|
||||
|
||||
|
||||
def turning_alert(direction: str):
|
||||
def func(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality, starpilot_toggles: SimpleNamespace) -> Alert:
|
||||
if starpilot_toggles.hide_turning_banner:
|
||||
return EmptyAlert
|
||||
return Alert(f"Turning {direction}", "", AlertStatus.normal, AlertSize.small, Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1)
|
||||
return func
|
||||
|
||||
|
||||
def changing_lanes_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality, starpilot_toggles: SimpleNamespace) -> Alert:
|
||||
if starpilot_toggles.hide_changing_lanes_banner:
|
||||
return EmptyAlert
|
||||
return Alert("Changing Lanes", "", AlertStatus.normal, AlertSize.small, Priority.LOW, VisualAlert.none, AudibleAlert.none, .1)
|
||||
|
||||
|
||||
def personality_changed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality, starpilot_toggles: SimpleNamespace) -> Alert:
|
||||
if starpilot_toggles.hide_distance_profile_banner:
|
||||
return EmptyAlert
|
||||
personality = str(personality).title()
|
||||
return NormalPermanentAlert(f"Driving Personality: {personality}", duration=1.5)
|
||||
|
||||
@@ -699,11 +715,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
},
|
||||
|
||||
EventName.laneChange: {
|
||||
ET.WARNING: Alert(
|
||||
"Changing Lanes",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.none, .1),
|
||||
ET.WARNING: changing_lanes_alert,
|
||||
},
|
||||
|
||||
EventName.steerSaturated: {
|
||||
@@ -1243,19 +1255,11 @@ STARPILOT_EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
},
|
||||
|
||||
StarPilotEventName.turningLeft: {
|
||||
ET.WARNING: Alert(
|
||||
"Turning Left",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1),
|
||||
ET.WARNING: turning_alert("Left"),
|
||||
},
|
||||
|
||||
StarPilotEventName.turningRight: {
|
||||
ET.WARNING: Alert(
|
||||
"Turning Right",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1),
|
||||
ET.WARNING: turning_alert("Right"),
|
||||
},
|
||||
|
||||
# Random Events
|
||||
|
||||
@@ -274,6 +274,22 @@ class StarPilotAppearanceLayout(_SettingsPage):
|
||||
subtitle="",
|
||||
get_state=lambda: self._params.get_bool("HideAlerts"),
|
||||
set_state=lambda s: self._params.put_bool("HideAlerts", s)),
|
||||
SettingRow("HideChangingLanesBanner", "toggle", tr_noop("Hide Changing Lanes Banner"),
|
||||
subtitle="",
|
||||
get_state=lambda: self._params.get_bool("HideChangingLanesBanner"),
|
||||
set_state=lambda s: self._params.put_bool("HideChangingLanesBanner", s)),
|
||||
SettingRow("HideDistanceProfileBanner", "toggle", tr_noop("Hide Distance Profile Banner"),
|
||||
subtitle="",
|
||||
get_state=lambda: self._params.get_bool("HideDistanceProfileBanner"),
|
||||
set_state=lambda s: self._params.put_bool("HideDistanceProfileBanner", s)),
|
||||
SettingRow("HideTurningBanner", "toggle", tr_noop("Hide Turning Banner"),
|
||||
subtitle="",
|
||||
get_state=lambda: self._params.get_bool("HideTurningBanner"),
|
||||
set_state=lambda s: self._params.put_bool("HideTurningBanner", s)),
|
||||
SettingRow("HideDMIcon", "toggle", tr_noop("Hide Driver Monitoring Icon"),
|
||||
subtitle="",
|
||||
get_state=lambda: self._params.get_bool("HideDMIcon"),
|
||||
set_state=lambda s: self._params.put_bool("HideDMIcon", s)),
|
||||
], tab_key="display", column_pair="display"),
|
||||
|
||||
SettingSection(tr_noop("Speed Info"), [
|
||||
|
||||
@@ -66,12 +66,9 @@ void DriverMonitorRenderer::updateState(const UIState &s) {
|
||||
void DriverMonitorRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
if (!is_visible) return;
|
||||
|
||||
painter.save();
|
||||
|
||||
int offset = UI_BORDER_SIZE + btn_size / 2;
|
||||
float x = is_rhd ? surface_rect.width() - offset : offset;
|
||||
float y = surface_rect.height() - offset;
|
||||
float opacity = is_active ? 0.65f : 0.2f;
|
||||
|
||||
if (onroad_distance_btn_enabled) {
|
||||
if (is_rhd) {
|
||||
@@ -85,6 +82,18 @@ void DriverMonitorRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
y -= UI_BORDER_SIZE;
|
||||
}
|
||||
|
||||
if (starpilot_nvg) {
|
||||
starpilot_nvg->dmIconPosition.setX(x);
|
||||
starpilot_nvg->dmIconPosition.setY(y);
|
||||
starpilot_nvg->rightHandDM = is_rhd;
|
||||
}
|
||||
|
||||
if (starpilot_toggles.value("hide_dm_icon").toBool()) return;
|
||||
|
||||
painter.save();
|
||||
|
||||
float opacity = is_active ? 0.65f : 0.2f;
|
||||
|
||||
drawIcon(painter, QPoint(x, y), dm_img, QColor(0, 0, 0, 70), opacity);
|
||||
|
||||
QPointF keypoints[std::size(DEFAULT_FACE_KPTS_3D)];
|
||||
@@ -116,10 +125,4 @@ void DriverMonitorRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
painter.drawArc(QRectF(x - arc_l / 2, std::min(y + delta_y, y), arc_l, std::abs(delta_y)), (driver_pose_sins[0] > 0 ? 0 : 180) * 16, 180 * 16);
|
||||
|
||||
painter.restore();
|
||||
|
||||
if (starpilot_nvg) {
|
||||
starpilot_nvg->dmIconPosition.setX(x);
|
||||
starpilot_nvg->dmIconPosition.setY(y);
|
||||
starpilot_nvg->rightHandDM = is_rhd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +561,10 @@ class StarPilotVariables:
|
||||
|
||||
advanced_custom_ui = self.get_value("AdvancedCustomUI")
|
||||
toggle.hide_alerts = self.get_value("HideAlerts", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
toggle.hide_changing_lanes_banner = self.get_value("HideChangingLanesBanner", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
toggle.hide_distance_profile_banner = self.get_value("HideDistanceProfileBanner", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
toggle.hide_turning_banner = self.get_value("HideTurningBanner", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
toggle.hide_dm_icon = self.get_value("HideDMIcon", condition=advanced_custom_ui) and not toggle.debug_mode
|
||||
toggle.hide_lead_marker = self.get_value("HideLeadMarker", condition=advanced_custom_ui and toggle.openpilot_longitudinal and not toggle.debug_mode)
|
||||
toggle.hide_max_speed = self.get_value("HideMaxSpeed", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
toggle.hide_speed = self.get_value("HideSpeed", condition=advanced_custom_ui and not toggle.debug_mode)
|
||||
@@ -1104,6 +1108,10 @@ class StarPilotVariables:
|
||||
toggle.wheel_image = "stock"
|
||||
|
||||
toggle.hide_alerts = False
|
||||
toggle.hide_changing_lanes_banner = False
|
||||
toggle.hide_distance_profile_banner = False
|
||||
toggle.hide_turning_banner = False
|
||||
toggle.hide_dm_icon = False
|
||||
toggle.hide_lead_marker = False
|
||||
toggle.hide_max_speed = False
|
||||
toggle.hide_speed = False
|
||||
|
||||
@@ -36,6 +36,10 @@ StarPilotVisualsPanel::StarPilotVisualsPanel(StarPilotSettingsWindow *parent, bo
|
||||
{"HideLeadMarker", tr("Hide Lead Marker"), tr("<b>Hide the lead-vehicle marker</b> from the driving screen."), ""},
|
||||
{"HideMaxSpeed", tr("Hide Max Speed"), tr("<b>Hide the max speed</b> from the driving screen."), ""},
|
||||
{"HideAlerts", tr("Hide Non-Critical Alerts"), tr("<b>Hide non-critical alerts</b> from the driving screen."), ""},
|
||||
{"HideChangingLanesBanner", tr("Hide Changing Lanes Banner"), tr("<b>Hide the 'Changing Lanes' banner</b> from the driving screen."), ""},
|
||||
{"HideDistanceProfileBanner", tr("Hide Distance Profile Banner"), tr("<b>Hide the driving personality banner</b> when changing distance profiles."), ""},
|
||||
{"HideDMIcon", tr("Hide Driver Monitoring Icon"), tr("<b>Hide the driver monitoring icon</b> from the driving screen."), ""},
|
||||
{"HideTurningBanner", tr("Hide Turning Banner"), tr("<b>Hide the 'Turning Left/Right' banner</b> from the driving screen."), ""},
|
||||
{"HideSpeedLimit", tr("Hide Speed Limits"), tr("<b>Hide posted speed limits</b> from the driving screen."), ""},
|
||||
{"HideSteeringWheel", tr("Hide Steering Wheel"), tr("<b>Hide the steering-wheel button</b> from the top-right of the driving screen."), ""},
|
||||
{"WheelSpeed", tr("Use Wheel Speed"), tr("<b>Use the vehicle's wheel speed</b> instead of the cluster speed. This is purely a visual change and doesn't impact how openpilot drives!"), ""},
|
||||
|
||||
@@ -23,7 +23,7 @@ private:
|
||||
|
||||
std::map<QString, AbstractControl*> toggles;
|
||||
|
||||
QSet<QString> advancedCustomOnroadUIKeys = {"HideAlerts", "HideLeadMarker", "HideMaxSpeed", "HideSpeed", "HideSpeedLimit", "HideSteeringWheel", "WheelSpeed"};
|
||||
QSet<QString> advancedCustomOnroadUIKeys = {"HideAlerts", "HideChangingLanesBanner", "HideDistanceProfileBanner", "HideDMIcon", "HideLeadMarker", "HideMaxSpeed", "HideSpeed", "HideSpeedLimit", "HideSteeringWheel", "HideTurningBanner", "WheelSpeed"};
|
||||
QSet<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "Compass", "OnroadDistanceButton", "PedalsOnUI", "RotatingWheel"};
|
||||
QSet<QString> modelUIKeys = {"DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth"};
|
||||
QSet<QString> navigationUIKeys = {"RoadNameUI", "ShowSpeedLimits", "SLCMapboxFiller", "UseVienna"};
|
||||
|
||||
Reference in New Issue
Block a user