diff --git a/common/params.cc b/common/params.cc index 9ae25c6b0..9d9114658 100644 --- a/common/params.cc +++ b/common/params.cc @@ -276,6 +276,7 @@ std::unordered_map keys = { {"ExperimentalModeViaDistance", PERSISTENT}, {"ExperimentalModeViaLKAS", PERSISTENT}, {"ExperimentalModeViaTap", PERSISTENT}, + {"Fahrenheit", PERSISTENT}, {"ForceAutoTune", PERSISTENT}, {"ForceFingerprint", PERSISTENT}, {"FPSCounter", PERSISTENT}, @@ -327,6 +328,7 @@ std::unordered_map keys = { {"NoLogging", PERSISTENT}, {"NoUploads", PERSISTENT}, {"NudgelessLaneChange", PERSISTENT}, + {"NumericalTemp", PERSISTENT}, {"OfflineMode", PERSISTENT}, {"OneLaneChange", PERSISTENT}, {"PathEdgeWidth", PERSISTENT}, diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc index 67dd716f2..b41d0c7c9 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc @@ -46,6 +46,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot {"CameraView", tr("Camera View"), tr("Choose your preferred camera view for the onroad UI. This is purely a visual change and doesn't impact how openpilot drives."), ""}, {"DriverCamera", tr("Driver Camera On Reverse"), tr("Show the driver camera feed when in reverse."), ""}, {"HideSpeed", tr("Hide Speed"), tr("Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself."), ""}, + {"NumericalTemp", tr("Numerical Temperature Gauge"), tr("Replace the 'GOOD', 'OK', and 'HIGH' temperature statuses with a numerical temperature gauge based on the highest temperature between the memory, CPU, and GPU."), ""}, }; for (const auto &[param, title, desc, icon] : visualToggles) { @@ -184,6 +185,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot std::vector hideSpeedToggles{"HideSpeedUI"}; std::vector hideSpeedToggleNames{tr("Control Via UI")}; toggle = new FrogPilotParamToggleControl(param, title, desc, icon, hideSpeedToggles, hideSpeedToggleNames); + } else if (param == "NumericalTemp") { + std::vector temperatureToggles{"Fahrenheit"}; + std::vector temperatureToggleNames{tr("Fahrenheit")}; + toggle = new FrogPilotParamToggleControl(param, title, desc, icon, temperatureToggles, temperatureToggleNames); } else { toggle = new ParamControl(param, title, desc, icon, this); diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h index 5aa663de0..171c09cb4 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h @@ -28,7 +28,7 @@ private: std::set customOnroadUIKeys = {"CustomPaths", "DeveloperUI", "FPSCounter", "LeadInfo"}; std::set customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "HolidayThemes"}; std::set modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"}; - std::set qolKeys = {"BigMap", "CameraView", "DriverCamera", "FullMap", "HideSpeed"}; + std::set qolKeys = {"BigMap", "CameraView", "DriverCamera", "FullMap", "HideSpeed", "NumericalTemp"}; std::set screenKeys = {}; std::map toggles; diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index 3bdfaa945..9a381b7ba 100644 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -99,9 +99,11 @@ void Sidebar::mousePressEvent(QMouseEvent *event) { // Declare the click boxes QRect cpuRect = {30, 496, 240, 126}; QRect memoryRect = {30, 654, 240, 126}; + QRect tempRect = {30, 338, 240, 126}; static int showChip = 0; static int showMemory = 0; + static int showTemp = 0; // Swap between the respective metrics upon tap if (cpuRect.contains(event->pos())) { @@ -125,6 +127,16 @@ void Sidebar::mousePressEvent(QMouseEvent *event) { params.putBoolNonBlocking("ShowStorageLeft", isStorageLeft); params.putBoolNonBlocking("ShowStorageUsed", isStorageUsed); + update(); + } else if (tempRect.contains(event->pos())) { + showTemp = (showTemp + 1) % 3; + + scene.fahrenheit = showTemp == 2; + scene.numerical_temp = showTemp != 0; + + params.putBoolNonBlocking("Fahrenheit", showTemp == 2); + params.putBoolNonBlocking("NumericalTemp", showTemp != 0); + update(); } else if (onroad && home_btn.contains(event->pos())) { flag_pressed = true; @@ -179,6 +191,11 @@ void Sidebar::updateState(const UIState &s) { auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState(); + bool isNumericalTemp = scene.numerical_temp; + + int maxTempC = deviceState.getMaxTempC(); + QString max_temp = scene.fahrenheit ? QString::number(maxTempC * 9 / 5 + 32) + "°F" : QString::number(maxTempC) + "°C"; + // FrogPilot metrics if (isCPU || isGPU) { auto cpu_loads = deviceState.getCpuUsagePercent(); @@ -238,12 +255,12 @@ void Sidebar::updateState(const UIState &s) { } setProperty("connectStatus", QVariant::fromValue(connectStatus)); - ItemStatus tempStatus = {{tr("TEMP"), tr("HIGH")}, danger_color}; + ItemStatus tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("HIGH")}, danger_color}; auto ts = deviceState.getThermalStatus(); if (ts == cereal::DeviceState::ThermalStatus::GREEN) { - tempStatus = {{tr("TEMP"), tr("GOOD")}, currentColors[0]}; + tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("GOOD")}, currentColors[0]}; } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) { - tempStatus = {{tr("TEMP"), tr("OK")}, warning_color}; + tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("OK")}, warning_color}; } setProperty("tempStatus", QVariant::fromValue(tempStatus)); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 8ce941ea5..9cb3f2eaa 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -353,6 +353,8 @@ void ui_update_frogpilot_params(UIState *s) { scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera"); scene.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed"); scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI"); + scene.numerical_temp = quality_of_life_visuals && params.getBool("NumericalTemp"); + scene.fahrenheit = scene.numerical_temp && params.getBool("Fahrenheit"); } void UIState::updateStatus() { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index d26b5bbb5..588c2d1ad 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -186,6 +186,7 @@ typedef struct UIScene { bool enabled; bool experimental_mode; bool experimental_mode_via_screen; + bool fahrenheit; bool fps_counter; bool full_map; bool has_auto_tune; @@ -197,6 +198,7 @@ typedef struct UIScene { bool live_valid; bool map_open; bool model_ui; + bool numerical_temp; bool online; bool reverse; bool reverse_cruise;