Numerical temperature gauge

Added toggle to replace the "GOOD", "OK", and "HIGH" temperature statuses with a numerical temperature gauge based on the highest temperature between the memory, CPU, and GPU and a function to swap between it by simply taping on the "Temp" gauge itself.
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent a8387af5f0
commit 232c2bd713
6 changed files with 30 additions and 3 deletions

View File

@@ -266,6 +266,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"ExperimentalModeViaDistance", PERSISTENT}, {"ExperimentalModeViaDistance", PERSISTENT},
{"ExperimentalModeViaLKAS", PERSISTENT}, {"ExperimentalModeViaLKAS", PERSISTENT},
{"ExperimentalModeViaScreen", PERSISTENT}, {"ExperimentalModeViaScreen", PERSISTENT},
{"Fahrenheit", PERSISTENT},
{"FireTheBabysitter", PERSISTENT}, {"FireTheBabysitter", PERSISTENT},
{"ForceAutoTune", PERSISTENT}, {"ForceAutoTune", PERSISTENT},
{"ForceFingerprint", PERSISTENT}, {"ForceFingerprint", PERSISTENT},
@@ -314,6 +315,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"NoLogging", PERSISTENT}, {"NoLogging", PERSISTENT},
{"NoUploads", PERSISTENT}, {"NoUploads", PERSISTENT},
{"NudgelessLaneChange", PERSISTENT}, {"NudgelessLaneChange", PERSISTENT},
{"NumericalTemp", PERSISTENT},
{"OneLaneChange", PERSISTENT}, {"OneLaneChange", PERSISTENT},
{"PathEdgeWidth", PERSISTENT}, {"PathEdgeWidth", PERSISTENT},
{"PathWidth", PERSISTENT}, {"PathWidth", PERSISTENT},

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -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.", ""}, {"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.", ""}, {"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"}, {"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.", ""}, {"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.", ""}, {"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") { } else if (param == "PathWidth") {
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, " feet", 10); toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, " feet", 10);
} else if (param == "NumericalTemp") {
std::vector<QString> temperatureToggles{"Fahrenheit"};
std::vector<QString> temperatureToggleNames{tr("Fahrenheit")};
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, temperatureToggles, temperatureToggleNames);
} else if (param == "QOLVisuals") { } else if (param == "QOLVisuals") {
FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {

View File

@@ -99,9 +99,11 @@ void Sidebar::mousePressEvent(QMouseEvent *event) {
// Declare the click boxes // Declare the click boxes
QRect cpuRect = {30, 496, 240, 126}; QRect cpuRect = {30, 496, 240, 126};
QRect memoryRect = {30, 654, 240, 126}; QRect memoryRect = {30, 654, 240, 126};
QRect tempRect = {30, 338, 240, 126};
static int showChip = 0; static int showChip = 0;
static int showMemory = 0; static int showMemory = 0;
static int showTemp = 0;
// Swap between the respective metrics upon tap // Swap between the respective metrics upon tap
if (cpuRect.contains(event->pos())) { if (cpuRect.contains(event->pos())) {
@@ -120,6 +122,13 @@ void Sidebar::mousePressEvent(QMouseEvent *event) {
params.putBoolNonBlocking("ShowStorageLeft", isStorageLeft); params.putBoolNonBlocking("ShowStorageLeft", isStorageLeft);
params.putBoolNonBlocking("ShowStorageUsed", isStorageUsed); params.putBoolNonBlocking("ShowStorageUsed", isStorageUsed);
update(); 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())) { } else if (onroad && home_btn.contains(event->pos())) {
flag_pressed = true; flag_pressed = true;
update(); update();
@@ -173,6 +182,10 @@ void Sidebar::updateState(const UIState &s) {
auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState(); 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]; QColor theme_color = currentColors[0];
// FrogPilot metrics // FrogPilot metrics
@@ -234,12 +247,12 @@ void Sidebar::updateState(const UIState &s) {
} }
setProperty("connectStatus", QVariant::fromValue(connectStatus)); 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(); auto ts = deviceState.getThermalStatus();
if (ts == cereal::DeviceState::ThermalStatus::GREEN) { 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) { } 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)); setProperty("tempStatus", QVariant::fromValue(tempStatus));

View File

@@ -311,6 +311,7 @@ void ui_update_frogpilot_params(UIState *s) {
scene.disable_smoothing_mtsc = params.getBool("DisableMTSCSmoothing"); scene.disable_smoothing_mtsc = params.getBool("DisableMTSCSmoothing");
scene.driver_camera = params.getBool("DriverCamera"); scene.driver_camera = params.getBool("DriverCamera");
scene.experimental_mode_via_screen = params.getBool("ExperimentalModeViaScreen") && params.getBool("ExperimentalModeActivation"); scene.experimental_mode_via_screen = params.getBool("ExperimentalModeViaScreen") && params.getBool("ExperimentalModeActivation");
scene.fahrenheit = params.getBool("Fahrenheit");
scene.model_ui = params.getBool("ModelUI"); scene.model_ui = params.getBool("ModelUI");
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth"); 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.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.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength");
scene.numerical_temp = params.getBool("NumericalTemp");
bool quality_of_life_controls = params.getBool("QOLControls"); bool quality_of_life_controls = params.getBool("QOLControls");
scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise"); scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise");
scene.reverse_cruise_ui = scene.reverse_cruise && params.getBool("ReverseCruiseUI"); scene.reverse_cruise_ui = scene.reverse_cruise && params.getBool("ReverseCruiseUI");

View File

@@ -184,6 +184,7 @@ typedef struct UIScene {
bool enabled; bool enabled;
bool experimental_mode; bool experimental_mode;
bool experimental_mode_via_screen; bool experimental_mode_via_screen;
bool fahrenheit;
bool fps_counter; bool fps_counter;
bool full_map; bool full_map;
bool hide_speed; bool hide_speed;
@@ -192,6 +193,7 @@ typedef struct UIScene {
bool lead_info; bool lead_info;
bool map_open; bool map_open;
bool model_ui; bool model_ui;
bool numerical_temp;
bool reverse_cruise; bool reverse_cruise;
bool reverse_cruise_ui; bool reverse_cruise_ui;
bool show_driver_camera; bool show_driver_camera;