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
72aa33447e
commit
43a884610a
@ -89,7 +89,21 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::mousePressEvent(QMouseEvent *event) {
|
void Sidebar::mousePressEvent(QMouseEvent *event) {
|
||||||
if (onroad && home_btn.contains(event->pos())) {
|
QRect tempRect = {30, 338, 240, 126};
|
||||||
|
|
||||||
|
static int showTemp = 0;
|
||||||
|
|
||||||
|
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;
|
flag_pressed = true;
|
||||||
update();
|
update();
|
||||||
} else if (settings_btn.contains(event->pos())) {
|
} else if (settings_btn.contains(event->pos())) {
|
||||||
@ -142,6 +156,11 @@ 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";
|
||||||
|
|
||||||
ItemStatus connectStatus;
|
ItemStatus connectStatus;
|
||||||
auto last_ping = deviceState.getLastAthenaPingTime();
|
auto last_ping = deviceState.getLastAthenaPingTime();
|
||||||
if (last_ping == 0) {
|
if (last_ping == 0) {
|
||||||
@ -153,12 +172,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")}, currentColors[0]};
|
tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("GOOD")}, currentColors[0]};
|
||||||
} 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));
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ private:
|
|||||||
Params params;
|
Params params;
|
||||||
UIScene &scene;
|
UIScene &scene;
|
||||||
|
|
||||||
|
bool isNumericalTemp;
|
||||||
|
|
||||||
std::unordered_map<int, std::pair<QString, std::vector<QColor>>> themeConfiguration;
|
std::unordered_map<int, std::pair<QString, std::vector<QColor>>> themeConfiguration;
|
||||||
std::unordered_map<int, QPixmap> flag_imgs;
|
std::unordered_map<int, QPixmap> flag_imgs;
|
||||||
std::unordered_map<int, QPixmap> home_imgs;
|
std::unordered_map<int, QPixmap> home_imgs;
|
||||||
|
@ -343,6 +343,8 @@ void ui_update_frogpilot_params(UIState *s) {
|
|||||||
scene.show_steering = border_metrics && params.getBool("ShowSteering");
|
scene.show_steering = border_metrics && params.getBool("ShowSteering");
|
||||||
scene.fps_counter = developer_ui && params.getBool("FPSCounter");
|
scene.fps_counter = developer_ui && params.getBool("FPSCounter");
|
||||||
scene.lead_info = scene.longitudinal_control && developer_ui && params.getBool("LongitudinalMetrics");
|
scene.lead_info = scene.longitudinal_control && developer_ui && params.getBool("LongitudinalMetrics");
|
||||||
|
scene.numerical_temp = developer_ui && params.getBool("NumericalTemp");
|
||||||
|
scene.fahrenheit = scene.numerical_temp && params.getBool("Fahrenheit");
|
||||||
scene.show_jerk = scene.longitudinal_control && developer_ui && params.getBool("LongitudinalMetrics");
|
scene.show_jerk = scene.longitudinal_control && developer_ui && params.getBool("LongitudinalMetrics");
|
||||||
scene.show_tuning = developer_ui && scene.has_auto_tune && params.getBool("LateralMetrics");
|
scene.show_tuning = developer_ui && scene.has_auto_tune && params.getBool("LateralMetrics");
|
||||||
|
|
||||||
|
@ -202,12 +202,14 @@ 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 has_auto_tune;
|
bool has_auto_tune;
|
||||||
bool holiday_themes;
|
bool holiday_themes;
|
||||||
bool lead_info;
|
bool lead_info;
|
||||||
bool live_valid;
|
bool live_valid;
|
||||||
bool map_open;
|
bool map_open;
|
||||||
|
bool numerical_temp;
|
||||||
bool online;
|
bool online;
|
||||||
bool onroad_distance_button;
|
bool onroad_distance_button;
|
||||||
bool parked;
|
bool parked;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user