diff --git a/common/params.cc b/common/params.cc index d1101cf..e11a185 100644 --- a/common/params.cc +++ b/common/params.cc @@ -266,6 +266,7 @@ std::unordered_map keys = { {"ExperimentalModeViaDistance", PERSISTENT}, {"ExperimentalModeViaLKAS", PERSISTENT}, {"ExperimentalModeViaScreen", PERSISTENT}, + {"Fahrenheit", PERSISTENT}, {"FireTheBabysitter", PERSISTENT}, {"ForceAutoTune", PERSISTENT}, {"ForceFingerprint", PERSISTENT}, @@ -314,6 +315,7 @@ std::unordered_map keys = { {"NoLogging", PERSISTENT}, {"NoUploads", PERSISTENT}, {"NudgelessLaneChange", PERSISTENT}, + {"NumericalTemp", PERSISTENT}, {"OneLaneChange", PERSISTENT}, {"PathEdgeWidth", PERSISTENT}, {"PathWidth", PERSISTENT}, diff --git a/selfdrive/frogpilot/assets/toggle_icons/icon_temperature.png b/selfdrive/frogpilot/assets/toggle_icons/icon_temperature.png new file mode 100644 index 0000000..8fab713 Binary files /dev/null and b/selfdrive/frogpilot/assets/toggle_icons/icon_temperature.png differ diff --git a/selfdrive/frogpilot/ui/visual_settings.cc b/selfdrive/frogpilot/ui/visual_settings.cc index 3af49aa..5b9a3a2 100644 --- a/selfdrive/frogpilot/ui/visual_settings.cc +++ b/selfdrive/frogpilot/ui/visual_settings.cc @@ -42,6 +42,8 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot {"RoadEdgesWidth", "Road Edges", "Adjust the visual thickness of road edges on your display.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.", ""}, {"UnlimitedLength", "'Unlimited' Road UI Length", "Extend the display of the path, lane lines, and road edges as far as the system can detect, providing a more expansive view of the road ahead.", ""}, + {"NumericalTemp", "Numerical Temperature Gauge", "Replace the 'GOOD', 'OK', and 'HIGH' temperature statuses with a numerical temperature gauge based on the highest temperature between the memory, CPU, and GPU.", "../frogpilot/assets/toggle_icons/icon_temperature.png"}, + {"QOLVisuals", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"}, {"DriveStats", "Drive Stats In Home Screen", "Display your device's drive stats in the home screen.", ""}, {"FullMap", "Full Sized Map", "Maximize the size of the map in the onroad UI.", ""}, @@ -142,6 +144,11 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot } else if (param == "PathWidth") { toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map(), this, false, " feet", 10); + } else if (param == "NumericalTemp") { + std::vector temperatureToggles{"Fahrenheit"}; + std::vector temperatureToggleNames{tr("Fahrenheit")}; + toggle = new FrogPilotParamToggleControl(param, title, desc, icon, temperatureToggles, temperatureToggleNames); + } else if (param == "QOLVisuals") { FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index e66a9ea..4ede551 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())) { @@ -120,6 +122,13 @@ 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; update(); @@ -173,6 +182,10 @@ 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"; QColor theme_color = currentColors[0]; // FrogPilot metrics @@ -234,12 +247,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")}, theme_color}; + tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("GOOD")}, theme_color}; } 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 31705d4..ad5d25b 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -311,6 +311,7 @@ void ui_update_frogpilot_params(UIState *s) { scene.disable_smoothing_mtsc = params.getBool("DisableMTSCSmoothing"); scene.driver_camera = params.getBool("DriverCamera"); scene.experimental_mode_via_screen = params.getBool("ExperimentalModeViaScreen") && params.getBool("ExperimentalModeActivation"); + scene.fahrenheit = params.getBool("Fahrenheit"); scene.model_ui = params.getBool("ModelUI"); scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth"); @@ -320,6 +321,8 @@ void ui_update_frogpilot_params(UIState *s) { scene.road_edge_width = params.getInt("RoadEdgesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f; scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength"); + scene.numerical_temp = params.getBool("NumericalTemp"); + bool quality_of_life_controls = params.getBool("QOLControls"); scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise"); scene.reverse_cruise_ui = scene.reverse_cruise && params.getBool("ReverseCruiseUI"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 2ce5f2d..c2d8833 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -184,6 +184,7 @@ typedef struct UIScene { bool enabled; bool experimental_mode; bool experimental_mode_via_screen; + bool fahrenheit; bool fps_counter; bool full_map; bool hide_speed; @@ -192,6 +193,7 @@ typedef struct UIScene { bool lead_info; bool map_open; bool model_ui; + bool numerical_temp; bool reverse_cruise; bool reverse_cruise_ui; bool show_driver_camera;