Added cpuTemperature

This commit is contained in:
Hendrik Rauh 2024-12-18 12:55:50 +01:00 committed by RaffaelW
parent 2fd3a76fa6
commit ceb3ce47ee
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,12 @@
#include "status.h"
float getTemperature()
{
float tempC = -1.0f;
temp_sensor_read_celsius(&tempC);
return tempC;
}
int8_t getWiFiStrength()
{
try
@ -22,6 +29,7 @@ void onGetStatus(AsyncWebServerRequest *request)
doc["chip"]["revision"] = ESP.getChipRevision();
doc["chip"]["cpuFreqMHz"] = ESP.getCpuFreqMHz();
doc["chip"]["cycleCount"] = ESP.getCycleCount();
doc["chip"]["tempC"] = getTemperature();
doc["sdkVersion"] = ESP.getSdkVersion();
doc["sketch"]["size"] = ESP.getSketchSize();
doc["sketch"]["md5"] = ESP.getSketchMD5();

View file

@ -1,4 +1,5 @@
#include <AsyncWebServer_ESP32_W5500.h>
#include <ArduinoJson.h>
#include <driver/temp_sensor.h>
void onGetStatus(AsyncWebServerRequest *request);