@@ -98,30 +98,60 @@ void Sidebar::updateState(const UIState &s) {
98
98
}
99
99
setProperty (" connectStatus" , QVariant::fromValue (connectStatus));
100
100
101
- if (millis_since_boot () - last_max_cpu_temp_count > 1000 * 1 ) {
102
- last_max_cpu_temp_count = millis_since_boot ();
103
-
104
- QString max_cpu_temp_str = " 0°C" ;
105
- const auto & cpu_temp_list = deviceState.getCpuTempC ();
106
- float max_cpu_temp = std::numeric_limits<float >::lowest ();
107
-
108
- for (const float & temp : cpu_temp_list) {
109
- max_cpu_temp = std::max (max_cpu_temp, temp);
101
+ if (millis_since_boot () - last_temp_count > 1000 * 1 ) {
102
+ last_temp_count = millis_since_boot ();
103
+
104
+ switch (s.scene .sidebar_temp_options ) {
105
+ case 0 :
106
+ sidebar_temp = QString::number ((int )deviceState.getAmbientTempC ());
107
+ break ;
108
+ case 1 :
109
+ sidebar_temp = QString::number ((int )deviceState.getMemoryTempC ());
110
+ break ;
111
+ case 2 : {
112
+ const auto & cpu_temp_list = deviceState.getCpuTempC ();
113
+ float max_cpu_temp = std::numeric_limits<float >::lowest ();
114
+
115
+ for (const float & temp : cpu_temp_list) {
116
+ max_cpu_temp = std::max (max_cpu_temp, temp);
117
+ }
118
+
119
+ if (max_cpu_temp >= 0 ) {
120
+ sidebar_temp = QString::number (std::nearbyint (max_cpu_temp));
121
+ }
122
+ break ;
123
+ }
124
+ case 3 : {
125
+ const auto & gpu_temp_list = deviceState.getGpuTempC ();
126
+ float max_gpu_temp = std::numeric_limits<float >::lowest ();
127
+
128
+ for (const float & temp : gpu_temp_list) {
129
+ max_gpu_temp = std::max (max_gpu_temp, temp);
130
+ }
131
+
132
+ if (max_gpu_temp >= 0 ) {
133
+ sidebar_temp = QString::number (std::nearbyint (max_gpu_temp));
134
+ }
135
+ break ;
136
+ }
137
+ case 4 :
138
+ sidebar_temp = QString::number ((int )deviceState.getMaxTempC ());
139
+ break ;
140
+ default :
141
+ break ;
110
142
}
111
143
112
- if (max_cpu_temp >= 0 ) {
113
- max_cpu_temp_str = QString::number (std::nearbyint (max_cpu_temp)) + " °C" ;
114
- }
144
+ setProperty (" sidebarTemp" , sidebar_temp + " °C" );
145
+ }
115
146
116
- ItemStatus tempStatus = {{tr (" TEMP" ), s.scene .sidebar_cpu_temp ? max_cpu_temp_str : tr (" HIGH" )}, danger_color};
117
- auto ts = deviceState.getThermalStatus ();
118
- if (ts == cereal::DeviceState::ThermalStatus::GREEN) {
119
- tempStatus = {{tr (" TEMP" ), s.scene .sidebar_cpu_temp ? max_cpu_temp_str : tr (" GOOD" )}, good_color};
120
- } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) {
121
- tempStatus = {{tr (" TEMP" ), s.scene .sidebar_cpu_temp ? max_cpu_temp_str : tr (" OK" )}, warning_color};
122
- }
123
- setProperty (" tempStatus" , QVariant::fromValue (tempStatus));
147
+ ItemStatus tempStatus = {{tr (" TEMP" ), s.scene .sidebar_temp ? sidebar_temp_str : tr (" HIGH" )}, danger_color};
148
+ auto ts = deviceState.getThermalStatus ();
149
+ if (ts == cereal::DeviceState::ThermalStatus::GREEN) {
150
+ tempStatus = {{tr (" TEMP" ), s.scene .sidebar_temp ? sidebar_temp_str : tr (" GOOD" )}, good_color};
151
+ } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) {
152
+ tempStatus = {{tr (" TEMP" ), s.scene .sidebar_temp ? sidebar_temp_str : tr (" OK" )}, warning_color};
124
153
}
154
+ setProperty (" tempStatus" , QVariant::fromValue (tempStatus));
125
155
126
156
ItemStatus pandaStatus = {{tr (" VEHICLE" ), tr (" ONLINE" )}, good_color};
127
157
if (s.scene .pandaType == cereal::PandaState::PandaType::UNKNOWN) {
0 commit comments