mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add application info, all memory info in kb
This commit is contained in:
9214
interface/package-lock.json
generated
9214
interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-dropzone": "^14.2.2",
|
"react-dropzone": "^14.2.2",
|
||||||
"react-icons": "^4.4.0",
|
"react-icons": "^4.4.0",
|
||||||
"react-router-dom": "^6.4.0",
|
"react-router-dom": "^6.4.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"sockette": "^2.0.6",
|
"sockette": "^2.0.6",
|
||||||
"typesafe-i18n": "^5.13.0",
|
"typesafe-i18n": "^5.13.0",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import ShowChartIcon from '@mui/icons-material/ShowChart';
|
|||||||
import MemoryIcon from '@mui/icons-material/Memory';
|
import MemoryIcon from '@mui/icons-material/Memory';
|
||||||
import AppsIcon from '@mui/icons-material/Apps';
|
import AppsIcon from '@mui/icons-material/Apps';
|
||||||
import SdStorageIcon from '@mui/icons-material/SdStorage';
|
import SdStorageIcon from '@mui/icons-material/SdStorage';
|
||||||
|
import SdCardAlertIcon from '@mui/icons-material/SdCardAlert';
|
||||||
import FolderIcon from '@mui/icons-material/Folder';
|
import FolderIcon from '@mui/icons-material/Folder';
|
||||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||||
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
|
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
|
||||||
@@ -272,14 +273,14 @@ const SystemStatusForm: FC = () => {
|
|||||||
primary={LL.HEAP()}
|
primary={LL.HEAP()}
|
||||||
secondary={
|
secondary={
|
||||||
formatNumber(data.free_heap) +
|
formatNumber(data.free_heap) +
|
||||||
' / ' +
|
' kb / ' +
|
||||||
formatNumber(data.max_alloc_heap) +
|
formatNumber(data.max_alloc_heap) +
|
||||||
' bytes ' +
|
' kb ' +
|
||||||
(data.esp_platform === EspPlatform.ESP8266 ? '(' + data.heap_fragmentation + '% fragmentation)' : '')
|
(data.esp_platform === EspPlatform.ESP8266 ? '(' + data.heap_fragmentation + '% fragmentation)' : '')
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
{data.esp_platform === EspPlatform.ESP32 && data.psram_size > 0 && (
|
{data.esp_platform === EspPlatform.ESP32 && data.psram_size !== undefined && data.free_psram !== undefined && (
|
||||||
<>
|
<>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
<ListItem>
|
<ListItem>
|
||||||
@@ -290,7 +291,7 @@ const SystemStatusForm: FC = () => {
|
|||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={LL.PSRAM()}
|
primary={LL.PSRAM()}
|
||||||
secondary={formatNumber(data.psram_size) + ' / ' + formatNumber(data.free_psram) + ' bytes'}
|
secondary={formatNumber(data.psram_size) + ' kb / ' + formatNumber(data.free_psram) + ' kb'}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</>
|
</>
|
||||||
@@ -305,7 +306,21 @@ const SystemStatusForm: FC = () => {
|
|||||||
<ListItemText
|
<ListItemText
|
||||||
primary={LL.FLASH()}
|
primary={LL.FLASH()}
|
||||||
secondary={
|
secondary={
|
||||||
formatNumber(data.flash_chip_size) + ' bytes / ' + (data.flash_chip_speed / 1000000).toFixed(0) + ' MHz'
|
formatNumber(data.flash_chip_size) + ' kb / ' + (data.flash_chip_speed / 1000000).toFixed(0) + ' MHz'
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
|
<ListItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<Avatar>
|
||||||
|
<SdCardAlertIcon />
|
||||||
|
</Avatar>
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText
|
||||||
|
primary={LL.APPSIZE()}
|
||||||
|
secondary={
|
||||||
|
formatNumber(data.app_size) + ' kb / ' + formatNumber(data.app_free) + ' kb'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
@@ -320,11 +335,11 @@ const SystemStatusForm: FC = () => {
|
|||||||
primary={LL.FILESYSTEM()}
|
primary={LL.FILESYSTEM()}
|
||||||
secondary={
|
secondary={
|
||||||
formatNumber(data.fs_used) +
|
formatNumber(data.fs_used) +
|
||||||
' / ' +
|
' kb / ' +
|
||||||
formatNumber(data.fs_total) +
|
formatNumber(data.fs_total) +
|
||||||
' bytes (' +
|
' kb (' +
|
||||||
formatNumber(data.fs_total - data.fs_used) +
|
formatNumber(data.fs_total - data.fs_used) +
|
||||||
'\xa0bytes free)'
|
'\xa0kb free)'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ const de: Translation = {
|
|||||||
HEAP: 'RAM Speicher (Frei / Max Belegt)',
|
HEAP: 'RAM Speicher (Frei / Max Belegt)',
|
||||||
PSRAM: 'PSRAM (Größe / Frei)',
|
PSRAM: 'PSRAM (Größe / Frei)',
|
||||||
FLASH: 'Flash Speicher (Größe / Geschwindigkeit)',
|
FLASH: 'Flash Speicher (Größe / Geschwindigkeit)',
|
||||||
|
APPSIZE: 'Programm (Größe / Frei)',
|
||||||
FILESYSTEM: 'Dateisystem (Genutzt / Gesamt)',
|
FILESYSTEM: 'Dateisystem (Genutzt / Gesamt)',
|
||||||
BUFFER_SIZE: 'Puffergröße',
|
BUFFER_SIZE: 'Puffergröße',
|
||||||
COMPACT: 'Kompakte Darstellung',
|
COMPACT: 'Kompakte Darstellung',
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ const en: BaseTranslation = {
|
|||||||
HEAP: 'Heap (Free / Max Alloc)',
|
HEAP: 'Heap (Free / Max Alloc)',
|
||||||
PSRAM: 'PSRAM (Size / Free)',
|
PSRAM: 'PSRAM (Size / Free)',
|
||||||
FLASH: 'Flash Chip (Size / Speed)',
|
FLASH: 'Flash Chip (Size / Speed)',
|
||||||
|
APPSIZE: 'Application (Size / Free)',
|
||||||
FILESYSTEM: 'File System (Used / Total)',
|
FILESYSTEM: 'File System (Used / Total)',
|
||||||
BUFFER_SIZE: 'Buffer Size',
|
BUFFER_SIZE: 'Buffer Size',
|
||||||
COMPACT: 'Compact',
|
COMPACT: 'Compact',
|
||||||
|
|||||||
@@ -729,6 +729,10 @@ type RootTranslation = {
|
|||||||
* Flash Chip (Size / Speed)
|
* Flash Chip (Size / Speed)
|
||||||
*/
|
*/
|
||||||
FLASH: string
|
FLASH: string
|
||||||
|
/**
|
||||||
|
* Application (Size / Free)
|
||||||
|
*/
|
||||||
|
APPSIZE: string
|
||||||
/**
|
/**
|
||||||
* File System (Used / Total)
|
* File System (Used / Total)
|
||||||
*/
|
*/
|
||||||
@@ -1742,6 +1746,10 @@ export type TranslationFunctions = {
|
|||||||
* Flash Chip (Size / Speed)
|
* Flash Chip (Size / Speed)
|
||||||
*/
|
*/
|
||||||
FLASH: () => LocalizedString
|
FLASH: () => LocalizedString
|
||||||
|
/**
|
||||||
|
* Application (Size / Free)
|
||||||
|
*/
|
||||||
|
APPSIZE: () => LocalizedString
|
||||||
/**
|
/**
|
||||||
* File System (Used / Total)
|
* File System (Used / Total)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ const nl: BaseTranslation = {
|
|||||||
HEAP: 'Heap (Free / Max Alloc)',
|
HEAP: 'Heap (Free / Max Alloc)',
|
||||||
PSRAM: 'PSRAM (Size / Free)',
|
PSRAM: 'PSRAM (Size / Free)',
|
||||||
FLASH: 'Flash Chip (Size / Speed)',
|
FLASH: 'Flash Chip (Size / Speed)',
|
||||||
|
APPSIZE: 'Application (Size / Free)',
|
||||||
FILESYSTEM: 'File System (Used / Total)',
|
FILESYSTEM: 'File System (Used / Total)',
|
||||||
BUFFER_SIZE: 'Buffer Size',
|
BUFFER_SIZE: 'Buffer Size',
|
||||||
COMPACT: 'Compact',
|
COMPACT: 'Compact',
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ const no: BaseTranslation = {
|
|||||||
HEAP: 'Heap (Free / Max Alloc)',
|
HEAP: 'Heap (Free / Max Alloc)',
|
||||||
PSRAM: 'PSRAM (Size / Free)',
|
PSRAM: 'PSRAM (Size / Free)',
|
||||||
FLASH: 'Flash Chip (Size / Speed)',
|
FLASH: 'Flash Chip (Size / Speed)',
|
||||||
|
APPSIZE: 'Application (Size / Free)',
|
||||||
FILESYSTEM: 'File System (Used / Total)',
|
FILESYSTEM: 'File System (Used / Total)',
|
||||||
BUFFER_SIZE: 'Buffer Size',
|
BUFFER_SIZE: 'Buffer Size',
|
||||||
COMPACT: 'Compact',
|
COMPACT: 'Compact',
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ const pl: BaseTranslation = {
|
|||||||
HEAP: 'Pamięć (Wolna / Zaalokowana)',
|
HEAP: 'Pamięć (Wolna / Zaalokowana)',
|
||||||
PSRAM: 'PSRAM (Rozmiar / Wolna)',
|
PSRAM: 'PSRAM (Rozmiar / Wolna)',
|
||||||
FLASH: 'Pamięć flash ( Rozmiar / Taktowanie)',
|
FLASH: 'Pamięć flash ( Rozmiar / Taktowanie)',
|
||||||
|
APPSIZE: 'Application (Size / Free)',
|
||||||
FILESYSTEM: 'System plików (Wykorzystano / Cała pojemność)',
|
FILESYSTEM: 'System plików (Wykorzystano / Cała pojemność)',
|
||||||
BUFFER_SIZE: 'Rozmiar bufora',
|
BUFFER_SIZE: 'Rozmiar bufora',
|
||||||
COMPACT: 'Kompaktowy',
|
COMPACT: 'Kompaktowy',
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ const se: BaseTranslation = {
|
|||||||
HEAP: 'Heap (Ledigt / Max allokerat)',
|
HEAP: 'Heap (Ledigt / Max allokerat)',
|
||||||
PSRAM: 'PSRAM (Storlek / Ledigt)',
|
PSRAM: 'PSRAM (Storlek / Ledigt)',
|
||||||
FLASH: 'Flash Chip (Storlek / Hastighet)',
|
FLASH: 'Flash Chip (Storlek / Hastighet)',
|
||||||
|
APPSIZE: 'Application (Size / Free)',
|
||||||
FILESYSTEM: 'Filsystem (Använt / Totalt)',
|
FILESYSTEM: 'Filsystem (Använt / Totalt)',
|
||||||
BUFFER_SIZE: 'Bufferstorlek',
|
BUFFER_SIZE: 'Bufferstorlek',
|
||||||
COMPACT: 'Komprimera',
|
COMPACT: 'Komprimera',
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ interface ESPSystemStatus {
|
|||||||
sdk_version: string;
|
sdk_version: string;
|
||||||
flash_chip_size: number;
|
flash_chip_size: number;
|
||||||
flash_chip_speed: number;
|
flash_chip_speed: number;
|
||||||
|
app_size: number;
|
||||||
|
app_free: number;
|
||||||
fs_used: number;
|
fs_used: number;
|
||||||
fs_total: number;
|
fs_total: number;
|
||||||
uptime: string;
|
uptime: string;
|
||||||
@@ -20,8 +22,8 @@ interface ESPSystemStatus {
|
|||||||
|
|
||||||
export interface ESP32SystemStatus extends ESPSystemStatus {
|
export interface ESP32SystemStatus extends ESPSystemStatus {
|
||||||
esp_platform: EspPlatform.ESP32;
|
esp_platform: EspPlatform.ESP32;
|
||||||
psram_size: number;
|
psram_size?: number;
|
||||||
free_psram: number;
|
free_psram?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ESP8266SystemStatus extends ESPSystemStatus {
|
export interface ESP8266SystemStatus extends ESPSystemStatus {
|
||||||
|
|||||||
@@ -15,17 +15,21 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) {
|
|||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
root["emsesp_version"] = EMSESP_APP_VERSION;
|
root["emsesp_version"] = EMSESP_APP_VERSION;
|
||||||
root["esp_platform"] = "ESP32";
|
root["esp_platform"] = "ESP32";
|
||||||
root["max_alloc_heap"] = ESP.getMaxAllocHeap();
|
root["max_alloc_heap"] = ESP.getMaxAllocHeap() / 1024;
|
||||||
root["psram_size"] = ESP.getPsramSize();
|
#if defined(BOARD_HAS_PSRAM)
|
||||||
root["free_psram"] = ESP.getFreePsram();
|
root["psram_size"] = ESP.getPsramSize() / 1024;
|
||||||
|
root["free_psram"] = ESP.getFreePsram() / 1024;
|
||||||
|
#endif
|
||||||
root["cpu_freq_mhz"] = ESP.getCpuFreqMHz();
|
root["cpu_freq_mhz"] = ESP.getCpuFreqMHz();
|
||||||
root["free_heap"] = ESP.getFreeHeap();
|
root["free_heap"] = ESP.getFreeHeap() / 1024;
|
||||||
root["sdk_version"] = ESP.getSdkVersion();
|
root["sdk_version"] = ESP.getSdkVersion();
|
||||||
root["flash_chip_size"] = ESP.getFlashChipSize();
|
root["flash_chip_size"] = ESP.getFlashChipSize() / 1024;
|
||||||
root["flash_chip_speed"] = ESP.getFlashChipSpeed();
|
root["flash_chip_speed"] = ESP.getFlashChipSpeed();
|
||||||
|
root["app_used"] = emsesp::EMSESP::system_.appUsed();
|
||||||
root["fs_total"] = emsesp::EMSESP::system_.FStotal();
|
root["app_free"] = emsesp::EMSESP::system_.appFree();
|
||||||
root["fs_used"] = LittleFS.usedBytes();
|
uint32_t FSused = LittleFS.usedBytes() / 1024;
|
||||||
|
root["fs_used"] = FSused;
|
||||||
|
root["fs_free"] = emsesp::EMSESP::system_.FStotal() - FSused;
|
||||||
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
root["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
|
|||||||
@@ -383,7 +383,9 @@ void System::start() {
|
|||||||
if (low_clock_) {
|
if (low_clock_) {
|
||||||
setCpuFrequencyMhz(160);
|
setCpuFrequencyMhz(160);
|
||||||
}
|
}
|
||||||
fstotal_ = LittleFS.totalBytes(); // read only once, it takes 500 ms to read
|
fstotal_ = LittleFS.totalBytes() / 1024; // read only once, it takes 500 ms to read
|
||||||
|
appused_ = ESP.getSketchSize() / 1024;
|
||||||
|
appfree_ = ESP.getFreeSketchSpace() / 1024 - appused_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||||
@@ -566,7 +568,7 @@ bool System::heartbeat_json(JsonObject & output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
output["freemem"] = ESP.getFreeHeap() / 1000L; // kilobytes
|
output["freemem"] = ESP.getFreeHeap() / 1024; // kilobytes
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
@@ -794,8 +796,10 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
shell.printfln(F(" SDK version: %s"), ESP.getSdkVersion());
|
shell.printfln(F(" SDK version: %s"), ESP.getSdkVersion());
|
||||||
shell.printfln(F(" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz());
|
shell.printfln(F(" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz());
|
||||||
shell.printfln(F(" Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
|
shell.printfln(F(" Free heap: %lu kb"), (uint32_t)ESP.getFreeHeap() / 1024);
|
||||||
shell.printfln(F(" FS used/total: %lu/%lu (bytes)"), LittleFS.usedBytes(), FStotal());
|
shell.printfln(F(" App used/free: %lu kb / %lu kb"), appUsed(), appFree());
|
||||||
|
uint32_t FSused = LittleFS.usedBytes() / 1024;
|
||||||
|
shell.printfln(F(" FS used/free: %lu kb / %lu kb"), FSused / 1024, FStotal() - FSused);
|
||||||
shell.println();
|
shell.println();
|
||||||
|
|
||||||
shell.println("Network:");
|
shell.println("Network:");
|
||||||
@@ -975,7 +979,8 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
node["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
node["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
||||||
// node["uptime (seconds)"] = uuid::get_uptime_sec();
|
// node["uptime (seconds)"] = uuid::get_uptime_sec();
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
node["freemem"] = ESP.getFreeHeap() / 1000L; // kilobytes
|
node["freemem"] = ESP.getFreeHeap() / 1024; // kilobytes
|
||||||
|
node["free_app"] = EMSESP::system_.appFree(); // kilobytes
|
||||||
#endif
|
#endif
|
||||||
node["reset reason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
|
node["reset reason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,12 @@ class System {
|
|||||||
uint32_t FStotal() {
|
uint32_t FStotal() {
|
||||||
return fstotal_;
|
return fstotal_;
|
||||||
}
|
}
|
||||||
|
uint32_t appFree() {
|
||||||
|
return appfree_;
|
||||||
|
}
|
||||||
|
uint32_t appUsed() {
|
||||||
|
return appused_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
@@ -299,6 +305,8 @@ class System {
|
|||||||
uint8_t eth_clock_mode_;
|
uint8_t eth_clock_mode_;
|
||||||
|
|
||||||
uint32_t fstotal_;
|
uint32_t fstotal_;
|
||||||
|
uint32_t appused_;
|
||||||
|
uint32_t appfree_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ void WebSettingsService::onUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WebSettings::has_flags(WebSettings::ChangeFlags::MQTT)) {
|
if (WebSettings::has_flags(WebSettings::ChangeFlags::MQTT)) {
|
||||||
emsesp::EMSESP::mqtt_.reset_mqtt(); // reload MQTT, init HA etc
|
emsesp::Mqtt::reset_mqtt(); // reload MQTT, init HA etc
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSettings::reset_flags();
|
WebSettings::reset_flags();
|
||||||
|
|||||||
Reference in New Issue
Block a user