Visuals - Developer UI - Use International System of Units

Display relevant metrics in the SI format.
This commit is contained in:
FrogAi 2024-06-19 20:26:20 -07:00
parent 59bed718b3
commit 0a10698124
4 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -124,6 +124,7 @@ private:
bool trafficModeActive;
bool turnSignalLeft;
bool turnSignalRight;
bool useSI;
bool useViennaSLCSign;
bool vtscControllingCurve;

View File

@ -371,6 +371,7 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
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");

View File

@ -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;