Browse Source

To get and average the temperature so it is more accurate, especially in low temperature

pull/1274/head
Kevin Le 5 months ago
parent
commit
0b30d2433f
  1. 9
      src/helpers/ESP32Board.h

9
src/helpers/ESP32Board.h

@ -44,7 +44,14 @@ public:
// Temperature from ESP32 MCU // Temperature from ESP32 MCU
float getMCUTemperature() override { float getMCUTemperature() override {
return temperatureRead(); uint32_t raw = 0;
// To get and average the temperature so it is more accurate, especially in low temperature
for (int i = 0; i < 4; i++) {
raw += temperatureRead();
}
return raw / 4;
} }
uint8_t getStartupReason() const override { return startup_reason; } uint8_t getStartupReason() const override { return startup_reason; }

Loading…
Cancel
Save