Numerical temperature gauge
Added function 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 by simply taping on the "Temp" gauge itself.
This commit is contained in:
@@ -251,6 +251,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"DisableOnroadUploads", PERSISTENT},
|
||||
{"DriverCamera", PERSISTENT},
|
||||
{"ExperimentalModeViaPress", PERSISTENT},
|
||||
{"Fahrenheit", PERSISTENT},
|
||||
{"FireTheBabysitter", PERSISTENT},
|
||||
{"FrogPilotTogglesUpdated", PERSISTENT},
|
||||
{"GasRegenCmd", PERSISTENT},
|
||||
@@ -285,6 +286,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"NNFFModelName", PERSISTENT},
|
||||
{"NoLogging", PERSISTENT},
|
||||
{"NudgelessLaneChange", PERSISTENT},
|
||||
{"NumericalTemp", PERSISTENT},
|
||||
{"OfflineMode", PERSISTENT},
|
||||
{"OneLaneChange", PERSISTENT},
|
||||
{"PathEdgeWidth", PERSISTENT},
|
||||
|
||||
@@ -48,6 +48,9 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
||||
isStorageLeft = params.getBool("ShowStorageLeft");
|
||||
isStorageUsed = params.getBool("ShowStorageUsed");
|
||||
|
||||
isNumericalTemp = params.getBool("NumericalTemp");
|
||||
isFahrenheit = params.getBool("Fahrenheit");
|
||||
|
||||
themeConfiguration = {
|
||||
{0, {"stock", {QColor(255, 255, 255)}}},
|
||||
{1, {"frog_theme", {QColor(23, 134, 68)}}},
|
||||
@@ -72,9 +75,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())) {
|
||||
@@ -93,6 +98,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;
|
||||
isNumericalTemp = (showTemp != 0);
|
||||
isFahrenheit = (showTemp == 2);
|
||||
params.putBoolNonBlocking("Fahrenheit", isFahrenheit);
|
||||
params.putBoolNonBlocking("NumericalTemp", isNumericalTemp);
|
||||
update();
|
||||
} else if (onroad && home_btn.contains(event->pos())) {
|
||||
flag_pressed = true;
|
||||
update();
|
||||
@@ -134,6 +146,8 @@ void Sidebar::updateState(const UIState &s) {
|
||||
// FrogPilot properties
|
||||
auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState();
|
||||
|
||||
int maxTempC = deviceState.getMaxTempC();
|
||||
QString max_temp = isFahrenheit ? QString::number(maxTempC * 9 / 5 + 32) + "°F" : QString::number(maxTempC) + "°C";
|
||||
QColor theme_color = currentColors[0];
|
||||
|
||||
// FrogPilot metrics
|
||||
@@ -195,12 +209,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));
|
||||
|
||||
|
||||
@@ -81,8 +81,10 @@ private:
|
||||
|
||||
bool isCPU;
|
||||
bool isCustomTheme;
|
||||
bool isFahrenheit;
|
||||
bool isGPU;
|
||||
bool isMemoryUsage;
|
||||
bool isNumericalTemp;
|
||||
bool isStorageLeft;
|
||||
bool isStorageUsed;
|
||||
int customColors;
|
||||
|
||||
Reference in New Issue
Block a user