Visuals - Model UI - Dynamic Path Width

Have the path width dynamically adjust based on the current engagement state of openpilot.
This commit is contained in:
FrogAi 2024-05-11 14:50:36 -07:00
parent 6ba34f8f40
commit ef5a0b4509
2 changed files with 13 additions and 0 deletions

View File

@ -108,6 +108,14 @@ void update_model(UIState *s,
}
// update path
float path;
if (scene.dynamic_path_width) {
float multiplier = scene.enabled ? 1.0f : scene.always_on_lateral_active ? 0.75f : 0.50f;
path = 0.9 * multiplier;
} else {
path = scene.path_width;
}
auto lead_count = model.getLeadsV3().size();
if (lead_count > 0) {
auto lead_one = model.getLeadsV3()[0];
@ -373,6 +381,9 @@ void ui_update_frogpilot_params(UIState *s) {
bool radarless_model = params.get("Model") == "radical-turtle";
scene.lead_detection_threshold = longitudinal_tune && !radarless_model ? params.getInt("LeadDetectionThreshold") / 100.0f : 0.5;
scene.model_ui = params.getBool("ModelUI");
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth");
bool quality_of_life_controls = params.getBool("QOLControls");
scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise");
scene.reverse_cruise_ui = params.getBool("ReverseCruiseUI");

View File

@ -133,6 +133,7 @@ typedef struct UIScene {
bool conditional_experimental;
bool disable_smoothing_mtsc;
bool disable_smoothing_vtsc;
bool dynamic_path_width;
bool dynamic_pedals_on_ui;
bool enabled;
bool experimental_mode;
@ -150,6 +151,7 @@ typedef struct UIScene {
bool lead_info;
bool live_valid;
bool map_open;
bool model_ui;
bool numerical_temp;
bool online;
bool onroad_distance_button;