mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-06 19:46:54 +03:00
remove_soc_temperature_for_s3_support
This commit is contained in:
@@ -33,10 +33,6 @@ extern "C"
|
|||||||
#include "esp_vfs_fat.h"
|
#include "esp_vfs_fat.h"
|
||||||
#include "../sdmmc_common.h"
|
#include "../sdmmc_common.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SOC_TEMP_SENSOR_SUPPORTED
|
|
||||||
#include "driver/temperature_sensor.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *TAG = "HELPER";
|
static const char *TAG = "HELPER";
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -617,64 +613,13 @@ string toLower(string in)
|
|||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SOC temperature sensor
|
// CPU Temp
|
||||||
#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
|
|
||||||
extern "C" uint8_t temprature_sens_read();
|
extern "C" uint8_t temprature_sens_read();
|
||||||
|
|
||||||
float temperatureRead()
|
float temperatureRead()
|
||||||
{
|
{
|
||||||
return (temprature_sens_read() - 32) / 1.8;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t addDays(time_t startTime, int days)
|
time_t addDays(time_t startTime, int days)
|
||||||
{
|
{
|
||||||
struct tm *tm = localtime(&startTime);
|
struct tm *tm = localtime(&startTime);
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ int removeFolder(const char* folderPath, const char* logTag);
|
|||||||
string toLower(string in);
|
string toLower(string in);
|
||||||
string toUpper(string in);
|
string toUpper(string in);
|
||||||
|
|
||||||
#ifdef CONFIG_SOC_TEMP_SENSOR_SUPPORTED
|
|
||||||
void initTemperatureSensor();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float temperatureRead();
|
float temperatureRead();
|
||||||
|
|
||||||
std::string intToHexString(int _valueInt);
|
std::string intToHexString(int _valueInt);
|
||||||
|
|||||||
@@ -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)
|
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
|
// Set CPU Frequency
|
||||||
// ********************************************
|
// ********************************************
|
||||||
setCpuFrequency();
|
setCpuFrequency();
|
||||||
|
|||||||
Reference in New Issue
Block a user