Visuals - Developer UI - 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.
This commit is contained in:
parent
21a6bb61d9
commit
b47cab142d
|
@ -92,12 +92,34 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
|||
}
|
||||
|
||||
void Sidebar::mousePressEvent(QMouseEvent *event) {
|
||||
if (onroad && home_btn.contains(event->pos())) {
|
||||
UIState *s = uiState();
|
||||
UIScene &scene = s->scene;
|
||||
|
||||
QPoint pos = event->pos();
|
||||
|
||||
QRect tempRect = {30, 338, 240, 126};
|
||||
|
||||
static int showTemp = 0;
|
||||
|
||||
if (tempRect.contains(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();
|
||||
return;
|
||||
} else if (onroad && home_btn.contains(pos)) {
|
||||
flag_pressed = true;
|
||||
update();
|
||||
} else if (settings_btn.contains(event->pos())) {
|
||||
return;
|
||||
} else if (settings_btn.contains(pos)) {
|
||||
settings_pressed = true;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +169,11 @@ void Sidebar::updateState(const UIState &s) {
|
|||
|
||||
auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState();
|
||||
|
||||
isNumericalTemp = scene.numerical_temp;
|
||||
|
||||
int maxTempC = deviceState.getMaxTempC();
|
||||
QString max_temp = scene.fahrenheit ? QString::number(maxTempC * 9 / 5 + 32) + "°F" : QString::number(maxTempC) + "°C";
|
||||
|
||||
ItemStatus connectStatus;
|
||||
auto last_ping = deviceState.getLastAthenaPingTime();
|
||||
if (last_ping == 0) {
|
||||
|
@ -158,12 +185,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));
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ private:
|
|||
// FrogPilot variables
|
||||
Params params;
|
||||
|
||||
bool isNumericalTemp;
|
||||
|
||||
std::unordered_map<int, std::pair<QString, std::vector<QColor>>> themeConfiguration;
|
||||
std::unordered_map<int, QPixmap> flag_imgs;
|
||||
std::unordered_map<int, QPixmap> home_imgs;
|
||||
|
|
|
@ -362,6 +362,8 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) {
|
|||
bool show_longitudinal = scene.longitudinal_control && developer_ui && params.getBool("LongitudinalMetrics");
|
||||
scene.lead_info = show_longitudinal && params.getBool("LeadInfo");
|
||||
scene.show_jerk = show_longitudinal && params.getBool("JerkInfo");
|
||||
scene.numerical_temp = developer_ui && params.getBool("NumericalTemp");
|
||||
scene.fahrenheit = scene.numerical_temp && params.getBool("Fahrenheit");
|
||||
|
||||
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
||||
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
||||
|
|
|
@ -138,6 +138,7 @@ typedef struct UIScene {
|
|||
bool enabled;
|
||||
bool experimental_mode;
|
||||
bool experimental_mode_via_screen;
|
||||
bool fahrenheit;
|
||||
bool has_auto_tune;
|
||||
bool has_lead;
|
||||
bool holiday_themes;
|
||||
|
@ -145,6 +146,7 @@ typedef struct UIScene {
|
|||
bool live_valid;
|
||||
bool map_open;
|
||||
bool model_randomizer;
|
||||
bool numerical_temp;
|
||||
bool online;
|
||||
bool onroad_distance_button;
|
||||
bool parked;
|
||||
|
|
Loading…
Reference in New Issue