Skip to content

Commit a26f28a

Browse files
authored
Merge pull request #1333 from jonny5532/fix/cpu-temperature
Fix: Ignore erroneous 53.3c CPU temperature value that ESP32 often returns
2 parents 3b59840 + 606f416 commit a26f28a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Software/Software.ino

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,14 @@ void check_interconnect_available() {
370370

371371
void update_calculated_values() {
372372
/* Update CPU temperature*/
373-
datalayer.system.info.CPU_temperature = temperatureRead();
373+
union {
374+
float temp;
375+
uint32_t hex;
376+
} temp = {.temp = temperatureRead()};
377+
if (temp.hex != 0x42555555) {
378+
// Ignoring erroneous temperature value that ESP32 sometimes returns
379+
datalayer.system.info.CPU_temperature = temp.temp;
380+
}
374381

375382
/* Calculate allowed charge/discharge currents*/
376383
if (datalayer.battery.status.voltage_dV > 10) {

0 commit comments

Comments
 (0)