diff --git a/code/components/jomjol_helper/Helper.cpp b/code/components/jomjol_helper/Helper.cpp index 8d3f8c34c..78d359e38 100644 --- a/code/components/jomjol_helper/Helper.cpp +++ b/code/components/jomjol_helper/Helper.cpp @@ -33,10 +33,6 @@ extern "C" #include "esp_vfs_fat.h" #include "../sdmmc_common.h" -#ifdef CONFIG_SOC_TEMP_SENSOR_SUPPORTED -#include "driver/temperature_sensor.h" -#endif - static const char *TAG = "HELPER"; using namespace std; @@ -617,62 +613,11 @@ string toLower(string in) return in; } -// SOC temperature sensor -#if defined(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) -static float socTemperature = -1; - -void taskSocTemp(void *pvParameter) -{ - temperature_sensor_handle_t socTempSensor = NULL; - temperature_sensor_config_t socTempSensorConfig = TEMPERATURE_SENSOR_CONFIG_DEFAULT(20, 100); - temperature_sensor_install(&socTempSensorConfig, &socTempSensor); - temperature_sensor_enable(socTempSensor); - - while (1) { - if (temperature_sensor_get_celsius(socTempSensor, &socTemperature) != ESP_OK) { - socTemperature = -1; - } - - vTaskDelay(pdMS_TO_TICKS(5000)); - } -} - -void initTemperatureSensor() -{ - // Create a dedicated task to ensure access temperature ressource only from a single source - BaseType_t xReturned = xTaskCreate(&taskSocTemp, "taskSocTemp", 2048, NULL, tskIDLE_PRIORITY + 1, NULL); - - if (xReturned != pdPASS) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to create taskSocTemp"); - } -} - -float temperatureRead() -{ - return socTemperature; -} - -#elif defined(CONFIG_IDF_TARGET_ESP32) // Inofficial support of vanilla ESP32. Value might be unreliable +// CPU Temp extern "C" uint8_t temprature_sens_read(); - float temperatureRead() { - return (temprature_sens_read() - 32) / 1.8; -} - -#else -#warning "SOC temperature sensor not supported" -float temperatureRead() -{ - return -1.0; -} -#endif - -std::string intToHexString(int _valueInt) -{ - char valueHex[33]; - sprintf(valueHex, "0x%02x", _valueInt); - return std::string(valueHex); + return (temprature_sens_read() - 32) / 1.8; } time_t addDays(time_t startTime, int days) diff --git a/code/components/jomjol_helper/Helper.h b/code/components/jomjol_helper/Helper.h index bbf97de14..ac6e33911 100644 --- a/code/components/jomjol_helper/Helper.h +++ b/code/components/jomjol_helper/Helper.h @@ -38,10 +38,6 @@ int removeFolder(const char* folderPath, const char* logTag); string toLower(string in); string toUpper(string in); -#ifdef CONFIG_SOC_TEMP_SENSOR_SUPPORTED -void initTemperatureSensor(); -#endif - float temperatureRead(); std::string intToHexString(int _valueInt); diff --git a/code/main/main.cpp b/code/main/main.cpp index d86b2f9ee..e8f4e98d0 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -374,12 +374,6 @@ extern "C" void app_main(void) // ******************************************** setupTime(); // NTP time service: Status of time synchronization will be checked after every round (server_tflite.cpp) - // Init SOC temperature sensor (if supported by hardware) - // ******************************************** -#if defined(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) - initTemperatureSensor(); -#endif - // Set CPU Frequency // ******************************************** setCpuFrequency();