Revert fix ESP32 temperature jump on some devices

Revert fix ESP32 temperature jump on some devices. It appears the device makes other non regular jumps too.
This commit is contained in:
Theo Arends 2021-10-10 11:22:53 +02:00
parent 134bbb2174
commit d510cfe261
1 changed files with 37 additions and 1 deletions

View File

@ -478,10 +478,13 @@ void *special_calloc(size_t num, size_t size) {
float CpuTemperature(void) {
#ifdef CONFIG_IDF_TARGET_ESP32
// return (float)temperatureRead(); // In Celsius
return (float)temperatureRead(); // In Celsius
/*
// These jumps are not stable either. Sometimes it jumps to 77.3
float t = (float)temperatureRead(); // In Celsius
if (t > 81) { t = t - 27.2; } // Fix temp jump observed on some ESP32 like DualR3
return t;
*/
#else
// Currently (20210801) repeated calls to temperatureRead() on ESP32C3 and ESP32S2 result in IDF error messages
static float t = NAN;
@ -492,6 +495,39 @@ float CpuTemperature(void) {
#endif
}
/*
#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();
#ifdef __cplusplus
}
#endif
#ifdef CONFIG_IDF_TARGET_ESP32
uint8_t temprature_sens_read();
float CpuTemperature(void) {
uint8_t t = temprature_sens_read();
AddLog(LOG_LEVEL_DEBUG, PSTR("TMP: value %d"), t);
return (t - 32) / 1.8;
}
#else
float CpuTemperature(void) {
// Currently (20210801) repeated calls to temperatureRead() on ESP32C3 and ESP32S2 result in IDF error messages
static float t = NAN;
if (isnan(t)) {
t = (float)temperatureRead(); // In Celsius
}
return t;
}
#endif
*/
/*
#if CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/esp_efuse.h"