mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
rename HardwareStatus
This commit is contained in:
@@ -3,13 +3,13 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
import type { ESPSystemStatus, LogSettings, SystemStatus } from 'types';
|
import type { HardwareStatus, LogSettings, SystemStatus } from 'types';
|
||||||
|
|
||||||
import { alovaInstance, alovaInstanceGH } from './endpoints';
|
import { alovaInstance, alovaInstanceGH } from './endpoints';
|
||||||
|
|
||||||
// ESPSystemStatus - also used to ping in Restart monitor for pinging
|
// HardwareStatus - also used to ping in Restart monitor for pinging
|
||||||
export const readESPSystemStatus = () =>
|
export const readHardwareStatus = () =>
|
||||||
alovaInstance.Get<ESPSystemStatus>('/rest/ESPSystemStatus');
|
alovaInstance.Get<HardwareStatus>('/rest/HardwareStatus');
|
||||||
|
|
||||||
// SystemStatus
|
// SystemStatus
|
||||||
export const readSystemStatus = () =>
|
export const readSystemStatus = () =>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const UploadDownload: FC = () => {
|
|||||||
data: data,
|
data: data,
|
||||||
send: loadData,
|
send: loadData,
|
||||||
error
|
error
|
||||||
} = useRequest(SystemApi.readESPSystemStatus, { force: true });
|
} = useRequest(SystemApi.readHardwareStatus, { force: true });
|
||||||
|
|
||||||
const { data: latestVersion } = useRequest(SystemApi.getStableVersion, {
|
const { data: latestVersion } = useRequest(SystemApi.getStableVersion, {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function formatNumber(num: number) {
|
|||||||
return new Intl.NumberFormat().format(num);
|
return new Intl.NumberFormat().format(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESPSystemStatus: FC = () => {
|
const HardwareStatus: FC = () => {
|
||||||
const { LL } = useI18nContext();
|
const { LL } = useI18nContext();
|
||||||
|
|
||||||
useLayoutTitle(LL.STATUS_OF(LL.HARDWARE()));
|
useLayoutTitle(LL.STATUS_OF(LL.HARDWARE()));
|
||||||
@@ -41,7 +41,7 @@ const ESPSystemStatus: FC = () => {
|
|||||||
data: data,
|
data: data,
|
||||||
send: loadData,
|
send: loadData,
|
||||||
error
|
error
|
||||||
} = useRequest(SystemApi.readESPSystemStatus, { force: true });
|
} = useRequest(SystemApi.readHardwareStatus, { force: true });
|
||||||
|
|
||||||
const content = () => {
|
const content = () => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -117,7 +117,9 @@ const ESPSystemStatus: FC = () => {
|
|||||||
formatNumber(data.free_heap) +
|
formatNumber(data.free_heap) +
|
||||||
' KB (' +
|
' KB (' +
|
||||||
formatNumber(data.max_alloc_heap) +
|
formatNumber(data.max_alloc_heap) +
|
||||||
' KB max alloc)'
|
' KB max alloc, ' +
|
||||||
|
formatNumber(data.free_caps) +
|
||||||
|
' KB caps)'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@@ -218,4 +220,4 @@ const ESPSystemStatus: FC = () => {
|
|||||||
return <SectionContent>{content()}</SectionContent>;
|
return <SectionContent>{content()}</SectionContent>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ESPSystemStatus;
|
export default HardwareStatus;
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ const SYSTEM_STATUS_ENDPOINT = REST_ENDPOINT_ROOT + 'systemStatus';
|
|||||||
const ACTIVITY_ENDPOINT = REST_ENDPOINT_ROOT + 'activity';
|
const ACTIVITY_ENDPOINT = REST_ENDPOINT_ROOT + 'activity';
|
||||||
|
|
||||||
// SETTINGS
|
// SETTINGS
|
||||||
const ESPSYSTEM_STATUS_ENDPOINT = REST_ENDPOINT_ROOT + 'ESPSystemStatus';
|
const HARDWARE_STATUS_ENDPOINT = REST_ENDPOINT_ROOT + 'HardwareStatus';
|
||||||
const SECURITY_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'securitySettings';
|
const SECURITY_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'securitySettings';
|
||||||
const RESTART_ENDPOINT = REST_ENDPOINT_ROOT + 'restart';
|
const RESTART_ENDPOINT = REST_ENDPOINT_ROOT + 'restart';
|
||||||
const RESTART_PARTITION_ENDPOINT = REST_ENDPOINT_ROOT + 'partition';
|
const RESTART_PARTITION_ENDPOINT = REST_ENDPOINT_ROOT + 'partition';
|
||||||
@@ -347,28 +347,29 @@ const VERIFY_AUTHORIZATION_ENDPOINT = REST_ENDPOINT_ROOT + 'verifyAuthorization'
|
|||||||
const SIGN_IN_ENDPOINT = REST_ENDPOINT_ROOT + 'signIn';
|
const SIGN_IN_ENDPOINT = REST_ENDPOINT_ROOT + 'signIn';
|
||||||
const GENERATE_TOKEN_ENDPOINT = REST_ENDPOINT_ROOT + 'generateToken';
|
const GENERATE_TOKEN_ENDPOINT = REST_ENDPOINT_ROOT + 'generateToken';
|
||||||
|
|
||||||
const ESPsystem_status = {
|
const hardware_status = {
|
||||||
emsesp_version: '3.7-demo',
|
emsesp_version: '3.7-demo',
|
||||||
esp_platform: 'ESP32',
|
esp_platform: 'ESP32',
|
||||||
max_alloc_heap: 89,
|
max_alloc_heap: 107,
|
||||||
cpu_type: 'ESP32-S3',
|
cpu_type: 'ESP32-S3',
|
||||||
cpu_rev: '0',
|
cpu_rev: 3,
|
||||||
cpu_cores: 2,
|
cpu_cores: 2,
|
||||||
cpu_freq_mhz: 240,
|
cpu_freq_mhz: 240,
|
||||||
free_heap: 143,
|
free_heap: 166,
|
||||||
arduino_version: 'ESP32 Arduino v2.0.14',
|
arduino_version: 'ESP32 Arduino v2.0.16',
|
||||||
sdk_version: 'v4.4.2',
|
sdk_version: 'v4.4.7',
|
||||||
partition: 'app0',
|
partition: 'app0',
|
||||||
flash_chip_size: 4096,
|
flash_chip_size: 4096,
|
||||||
flash_chip_speed: 40000000,
|
flash_chip_speed: 40000000,
|
||||||
app_used: 1863,
|
app_used: 1863,
|
||||||
app_free: 121,
|
app_free: 121,
|
||||||
fs_used: 40,
|
fs_used: 24,
|
||||||
fs_free: 24,
|
fs_free: 2024,
|
||||||
free_mem: 100,
|
free_mem: 100,
|
||||||
psram_size: 0,
|
psram_size: 4093,
|
||||||
free_psram: 0,
|
free_psram: 4074,
|
||||||
has_loader: true,
|
has_loader: true,
|
||||||
|
free_caps: 4204,
|
||||||
// model: ''
|
// model: ''
|
||||||
model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)'
|
model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)'
|
||||||
};
|
};
|
||||||
@@ -4203,7 +4204,7 @@ router
|
|||||||
router
|
router
|
||||||
.get(SYSTEM_STATUS_ENDPOINT, () => system_status)
|
.get(SYSTEM_STATUS_ENDPOINT, () => system_status)
|
||||||
.get(ACTIVITY_ENDPOINT, () => activity)
|
.get(ACTIVITY_ENDPOINT, () => activity)
|
||||||
.get(ESPSYSTEM_STATUS_ENDPOINT, () => ESPsystem_status)
|
.get(HARDWARE_STATUS_ENDPOINT, () => hardware_status)
|
||||||
.get(SECURITY_SETTINGS_ENDPOINT, () => security_settings)
|
.get(SECURITY_SETTINGS_ENDPOINT, () => security_settings)
|
||||||
.post(SECURITY_SETTINGS_ENDPOINT, async (request: any) => {
|
.post(SECURITY_SETTINGS_ENDPOINT, async (request: any) => {
|
||||||
security_settings = await request.json();
|
security_settings = await request.json();
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
// /rest/ESPSystemStatus
|
// /rest/HardwareStatus
|
||||||
WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * securityManager) {
|
WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * securityManager) {
|
||||||
server->on(ESPSYSTEM_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { ESPsystemStatus(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::ESPsystemStatus(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);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef WebStatusService_h
|
#ifndef WebStatusService_h
|
||||||
#define WebStatusService_h
|
#define WebStatusService_h
|
||||||
|
|
||||||
#define ESPSYSTEM_STATUS_SERVICE_PATH "/rest/ESPSystemStatus"
|
#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 ESPsystemStatus(AsyncWebServerRequest * request);
|
void HardwareStatus(AsyncWebServerRequest * request);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user