Hide HUD - init

This commit is contained in:
Rick Lan
2025-04-01 11:19:57 +08:00
parent c7b91221ff
commit 07c7f009cd
6 changed files with 16 additions and 3 deletions
+1
View File
@@ -119,4 +119,5 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
{"Version", PERSISTENT},
{"dp_device_last_log", CLEAR_ON_MANAGER_START},
{"dp_device_reset_conf", CLEAR_ON_MANAGER_START},
{"dp_ui_hide_hud_speed_kph", PERSISTENT},
};
+3
View File
@@ -173,6 +173,7 @@ void DPPanel::add_ui_toggles() {
"",
},
};
auto hide_hud = new ParamSpinBoxControl("dp_ui_hide_hud_speed_kph", tr("Hide HUD When Moves above:"), tr("To prevent screen burn-in, hide Speed, MAX Speed, and Steering/DM Icons when the car moves.\nOff = Stock Behavior\n1 km/h ≈ 0.6 mph"), "", 0, 120, 5, tr(" km/h"), tr("Off"));
QWidget *label = nullptr;
bool has_toggle = false;
@@ -181,6 +182,8 @@ void DPPanel::add_ui_toggles() {
if (param.isEmpty()) {
label = new LabelControl(title, "");
addItem(label);
addItem(hide_hud);
has_toggle = true;
continue;
}
+9 -3
View File
@@ -130,9 +130,15 @@ void AnnotatedCameraWidget::paintGL() {
painter.setPen(Qt::NoPen);
model.draw(painter, rect());
dmon.draw(painter, rect());
hud.updateState(*s);
hud.draw(painter, rect());
bool hide_hud = s->scene.dp_ui_hide_hud_speed_kph > 0 && sm["carState"].getCarState().getVEgo() > s->scene.dp_ui_hide_hud_speed_kph * 0.278;
if (!hide_hud) {
dmon.draw(painter, rect());
hud.updateState(*s);
hud.draw(painter, rect());
experimental_btn->setVisible(true);
} else {
experimental_btn->setVisible(false);
}
double cur_draw_t = millis_since_boot();
double dt = cur_draw_t - prev_draw_t;
+1
View File
@@ -65,6 +65,7 @@ static void update_state(UIState *s) {
void ui_update_params(UIState *s) {
auto params = Params();
s->scene.is_metric = params.getBool("IsMetric");
s->scene.dp_ui_hide_hud_speed_kph = std::atoi(params.get("dp_ui_hide_hud_speed_kph").c_str());
}
void UIState::updateStatus() {
+1
View File
@@ -60,6 +60,7 @@ typedef struct UIScene {
float light_sensor = -1;
bool started, ignition, is_metric;
uint64_t started_frame;
int dp_ui_hide_hud_speed_kph = 0;
} UIScene;
class UIState : public QObject {
+1
View File
@@ -41,6 +41,7 @@ def manager_init() -> None:
("OpenpilotEnabledToggle", "1"),
("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)),
("DisableLogging", "0"),
("dp_ui_hide_hud_speed_kph", "0"),
]
if params.get_bool("RecordFrontLock"):