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 0a10698124
commit c71a12f56f
2 changed files with 13 additions and 0 deletions

View File

@ -114,6 +114,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];
@ -392,6 +400,9 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
bool model_manager = params.getBool("ModelManagement");
scene.model_randomizer = model_manager && params.getBool("ModelRandomizer");
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

@ -134,6 +134,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;
@ -152,6 +153,7 @@ typedef struct UIScene {
bool live_valid;
bool map_open;
bool model_randomizer;
bool model_ui;
bool numerical_temp;
bool online;
bool onroad_distance_button;