mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
rename HardwareStatus to hardwareStatus
This commit is contained in:
@@ -7,9 +7,9 @@ import type { HardwareStatus, LogSettings, SystemStatus } from 'types';
|
|||||||
|
|
||||||
import { alovaInstance, alovaInstanceGH } from './endpoints';
|
import { alovaInstance, alovaInstanceGH } from './endpoints';
|
||||||
|
|
||||||
// HardwareStatus - also used to ping in Restart monitor for pinging
|
// hardwareStatus - also used to ping in Restart monitor for pinging
|
||||||
export const readHardwareStatus = () =>
|
export const readHardwareStatus = () =>
|
||||||
alovaInstance.Get<HardwareStatus>('/rest/HardwareStatus');
|
alovaInstance.Get<HardwareStatus>('/rest/hardwareStatus');
|
||||||
|
|
||||||
// SystemStatus
|
// SystemStatus
|
||||||
export const readSystemStatus = () =>
|
export const readSystemStatus = () =>
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
// /rest/HardwareStatus
|
// /rest/hardwareStatus
|
||||||
WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * securityManager) {
|
WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * securityManager) {
|
||||||
server->on(HARDWARE_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { HardwareStatus(request); });
|
server->on(HARDWARE_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { hardwareStatus(request); });
|
||||||
server->on(SYSTEM_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { systemStatus(request); });
|
server->on(SYSTEM_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { systemStatus(request); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
|||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebStatusService::HardwareStatus(AsyncWebServerRequest * request) {
|
void WebStatusService::hardwareStatus(AsyncWebServerRequest * request) {
|
||||||
EMSESP::system_.refreshHeapMem(); // refresh free heap and max alloc heap
|
EMSESP::system_.refreshHeapMem(); // refresh free heap and max alloc heap
|
||||||
|
|
||||||
auto * response = new AsyncJsonResponse(false);
|
auto * response = new AsyncJsonResponse(false);
|
||||||
@@ -121,6 +121,7 @@ void WebStatusService::HardwareStatus(AsyncWebServerRequest * request) {
|
|||||||
root["fs_free"] = EMSESP::system_.FStotal() - FSused;
|
root["fs_free"] = EMSESP::system_.FStotal() - FSused;
|
||||||
root["free_caps"] = heap_caps_get_free_size(MALLOC_CAP_8BIT) / 1024; // includes heap and psram
|
root["free_caps"] = heap_caps_get_free_size(MALLOC_CAP_8BIT) / 1024; // includes heap and psram
|
||||||
|
|
||||||
|
root["psram"] = EMSESP::system_.PSram();
|
||||||
if (EMSESP::system_.PSram()) {
|
if (EMSESP::system_.PSram()) {
|
||||||
root["psram_size"] = EMSESP::system_.PSram();
|
root["psram_size"] = EMSESP::system_.PSram();
|
||||||
root["free_psram"] = ESP.getFreePsram() / 1024;
|
root["free_psram"] = ESP.getFreePsram() / 1024;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef WebStatusService_h
|
#ifndef WebStatusService_h
|
||||||
#define WebStatusService_h
|
#define WebStatusService_h
|
||||||
|
|
||||||
#define HARDWARE_STATUS_SERVICE_PATH "/rest/HardwareStatus"
|
#define HARDWARE_STATUS_SERVICE_PATH "/rest/hardwareStatus"
|
||||||
#define SYSTEM_STATUS_SERVICE_PATH "/rest/systemStatus"
|
#define SYSTEM_STATUS_SERVICE_PATH "/rest/systemStatus"
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
@@ -12,7 +12,7 @@ class WebStatusService {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void systemStatus(AsyncWebServerRequest * request);
|
void systemStatus(AsyncWebServerRequest * request);
|
||||||
void HardwareStatus(AsyncWebServerRequest * request);
|
void hardwareStatus(AsyncWebServerRequest * request);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user