diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index 07890b415..950416abb 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -733,14 +733,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"); @@ -850,6 +850,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 bde006211..9c088e497 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -370,6 +370,7 @@ void ui_update_frogpilot_params(UIState *s) { 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 1c8a932fe..b5dd04e5e 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -185,6 +185,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;