Skip to content

Commit 606f416

Browse files
author
Jonny
committed
Ignore erroneous 53.3c CPU temperature value that ESP32 often returns
1 parent 3b80dcb commit 606f416

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
@@ -361,7 +361,14 @@ void check_interconnect_available() {
361361

362362
void update_calculated_values() {
363363
/* Update CPU temperature*/
364-
datalayer.system.info.CPU_temperature = temperatureRead();
364+
union {
365+
float temp;
366+
uint32_t hex;
367+
} temp = {.temp = temperatureRead()};
368+
if (temp.hex != 0x42555555) {
369+
// Ignoring erroneous temperature value that ESP32 sometimes returns
370+
datalayer.system.info.CPU_temperature = temp.temp;
371+
}
365372

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

0 commit comments

Comments
 (0)