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},
|
{"DisableOnroadUploads", PERSISTENT},
|
||||||
{"DriverCamera", PERSISTENT},
|
{"DriverCamera", PERSISTENT},
|
||||||
{"ExperimentalModeViaPress", PERSISTENT},
|
{"ExperimentalModeViaPress", PERSISTENT},
|
||||||
|
{"Fahrenheit", PERSISTENT},
|
||||||
{"FireTheBabysitter", PERSISTENT},
|
{"FireTheBabysitter", PERSISTENT},
|
||||||
{"FrogPilotTogglesUpdated", PERSISTENT},
|
{"FrogPilotTogglesUpdated", PERSISTENT},
|
||||||
{"GasRegenCmd", PERSISTENT},
|
{"GasRegenCmd", PERSISTENT},
|
||||||
@@ -285,6 +286,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"NNFFModelName", PERSISTENT},
|
{"NNFFModelName", PERSISTENT},
|
||||||
{"NoLogging", PERSISTENT},
|
{"NoLogging", PERSISTENT},
|
||||||
{"NudgelessLaneChange", PERSISTENT},
|
{"NudgelessLaneChange", PERSISTENT},
|
||||||
|
{"NumericalTemp", PERSISTENT},
|
||||||
{"OfflineMode", PERSISTENT},
|
{"OfflineMode", PERSISTENT},
|
||||||
{"OneLaneChange", PERSISTENT},
|
{"OneLaneChange", PERSISTENT},
|
||||||
{"PathEdgeWidth", PERSISTENT},
|
{"PathEdgeWidth", PERSISTENT},
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
|||||||
isStorageLeft = params.getBool("ShowStorageLeft");
|
isStorageLeft = params.getBool("ShowStorageLeft");
|
||||||
isStorageUsed = params.getBool("ShowStorageUsed");
|
isStorageUsed = params.getBool("ShowStorageUsed");
|
||||||
|
|
||||||
|
isNumericalTemp = params.getBool("NumericalTemp");
|
||||||
|
isFahrenheit = params.getBool("Fahrenheit");
|
||||||
|
|
||||||
themeConfiguration = {
|
themeConfiguration = {
|
||||||
{0, {"stock", {QColor(255, 255, 255)}}},
|
{0, {"stock", {QColor(255, 255, 255)}}},
|
||||||
{1, {"frog_theme", {QColor(23, 134, 68)}}},
|
{1, {"frog_theme", {QColor(23, 134, 68)}}},
|
||||||
@@ -72,9 +75,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())) {
|
||||||
@@ -93,6 +98,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;
|
||||||
|
isNumericalTemp = (showTemp != 0);
|
||||||
|
isFahrenheit = (showTemp == 2);
|
||||||
|
params.putBoolNonBlocking("Fahrenheit", isFahrenheit);
|
||||||
|
params.putBoolNonBlocking("NumericalTemp", isNumericalTemp);
|
||||||
|
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();
|
||||||
@@ -134,6 +146,8 @@ void Sidebar::updateState(const UIState &s) {
|
|||||||
// FrogPilot properties
|
// FrogPilot properties
|
||||||
auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState();
|
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];
|
QColor theme_color = currentColors[0];
|
||||||
|
|
||||||
// FrogPilot metrics
|
// FrogPilot metrics
|
||||||
@@ -195,12 +209,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));
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,10 @@ private:
|
|||||||
|
|
||||||
bool isCPU;
|
bool isCPU;
|
||||||
bool isCustomTheme;
|
bool isCustomTheme;
|
||||||
|
bool isFahrenheit;
|
||||||
bool isGPU;
|
bool isGPU;
|
||||||
bool isMemoryUsage;
|
bool isMemoryUsage;
|
||||||
|
bool isNumericalTemp;
|
||||||
bool isStorageLeft;
|
bool isStorageLeft;
|
||||||
bool isStorageUsed;
|
bool isStorageUsed;
|
||||||
int customColors;
|
int customColors;
|
||||||
|
|||||||
Reference in New Issue
Block a user