diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index a752e2a30..43d01de10 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -736,14 +736,14 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() { } void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UIScene &scene) { - if (is_metric) { + if (is_metric || useSI) { accelerationUnit = tr("m/s²"); leadDistanceUnit = tr(mapOpen ? "m" : "meters"); - leadSpeedUnit = tr("kph"); + leadSpeedUnit = useSI ? tr("m/s") : tr("kph"); accelerationConversion = 1.0f; distanceConversion = 1.0f; - speedConversion = MS_TO_KPH; + speedConversion = useSI ? 1.0f : MS_TO_KPH; } else { accelerationUnit = tr(" ft/s²"); leadDistanceUnit = tr(mapOpen ? "ft" : "feet"); @@ -853,6 +853,8 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UISce animationTimer->stop(); } + useSI = scene.use_si; + if (currentHolidayTheme != scene.current_holiday_theme || customSignals != scene.custom_signals) { currentHolidayTheme = scene.current_holiday_theme; customSignals = scene.custom_signals; diff --git a/selfdrive/ui/qt/onroad/annotated_camera.h b/selfdrive/ui/qt/onroad/annotated_camera.h index c56eef406..9c640a116 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.h +++ b/selfdrive/ui/qt/onroad/annotated_camera.h @@ -124,6 +124,7 @@ private: bool trafficModeActive; bool turnSignalLeft; bool turnSignalRight; + bool useSI; bool useViennaSLCSign; bool vtscControllingCurve; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 536399a56..2fae344d5 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -371,6 +371,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { scene.is_memory = scene.sidebar_metrics && params.getBool("ShowMemoryUsage"); scene.is_storage_left = scene.sidebar_metrics && params.getBool("ShowStorageLeft"); scene.is_storage_used = scene.sidebar_metrics && params.getBool("ShowStorageUsed"); + scene.use_si = developer_ui && params.getBool("UseSI"); scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing"); scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 0b6fd96fd..d7f27c1d4 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -189,6 +189,7 @@ typedef struct UIScene { bool turn_signal_left; bool turn_signal_right; bool use_kaofui_icons; + bool use_si; bool use_vienna_slc_sign; bool vtsc_controlling_curve;