mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
memory remain
This commit is contained in:
Binary file not shown.
@@ -49,6 +49,14 @@
|
|||||||
"type": "h4",
|
"type": "h4",
|
||||||
"title": "{{signal}}"
|
"title": "{{signal}}"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "h4",
|
||||||
|
"title": "Осталось памяти: {{freeBytes}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "h4",
|
||||||
|
"title": "Осталось памяти: {{freePer}} %"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "hr"
|
"type": "hr"
|
||||||
},
|
},
|
||||||
|
|||||||
BIN
data_ungzip/set.device.json.gz
Normal file
BIN
data_ungzip/set.device.json.gz
Normal file
Binary file not shown.
@@ -10,27 +10,15 @@
|
|||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
extern FS LittleFS;
|
extern FS LittleFS;
|
||||||
using littlefs_impl::LittleFSConfig;
|
using littlefs_impl::LittleFSConfig;
|
||||||
extern FS *filesystem;
|
extern FS* filesystem;
|
||||||
#define FileFS LittleFS
|
#define FileFS LittleFS
|
||||||
#define FS_NAME "LittleFS"
|
#define FS_NAME "LittleFS"
|
||||||
#else
|
#else
|
||||||
extern FS *filesystem;
|
extern FS* filesystem;
|
||||||
#define FileFS SPIFFS
|
#define FileFS SPIFFS
|
||||||
#define FS_NAME "SPIFFS"
|
#define FS_NAME "SPIFFS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Информация о ФС
|
|
||||||
size_t totalBytes; // всего
|
|
||||||
size_t usedBytes; // использовано
|
|
||||||
size_t maxOpenFiles; // лимит на открые файлы
|
|
||||||
size_t maxPathLength; // лимит на полное пути + имя файла
|
|
||||||
|
|
||||||
FSInfo buf;
|
extern void getFSInfo();
|
||||||
getInfo(buf);
|
extern bool getInfo(FSInfo& info);
|
||||||
size_t freeBytes = buf.totalBytes - buf.usedBytes;
|
|
||||||
float freePer = buf.usedBytes / buf.totalBytes * 100;
|
|
||||||
*/
|
|
||||||
bool getInfo(FSInfo& info) {
|
|
||||||
return FileFS.info(info);
|
|
||||||
}
|
|
||||||
22
src/FileSystem.cpp
Normal file
22
src/FileSystem.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "FileSystem.h"
|
||||||
|
#include "Global.h"
|
||||||
|
|
||||||
|
void getFSInfo() {
|
||||||
|
// Информация о ФС
|
||||||
|
size_t totalBytes; // всего
|
||||||
|
size_t usedBytes; // использовано
|
||||||
|
size_t maxOpenFiles; // лимит на открые файлы
|
||||||
|
size_t maxPathLength; // лимит на полное пути + имя файла
|
||||||
|
|
||||||
|
FSInfo buf;
|
||||||
|
getInfo(buf);
|
||||||
|
size_t freeBytes = buf.totalBytes - buf.usedBytes;
|
||||||
|
float freePer = buf.usedBytes / buf.totalBytes * 100;
|
||||||
|
|
||||||
|
jsonWriteInt(configSetupJson, F("freeBytes"), freeBytes);
|
||||||
|
jsonWriteFloat(configSetupJson, F("freePer"), freePer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getInfo(FSInfo& info) {
|
||||||
|
return FileFS.info(info);
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "items/vSensorUltrasonic.h"
|
#include "items/vSensorUltrasonic.h"
|
||||||
#include "Telegram.h"
|
#include "Telegram.h"
|
||||||
#include "SoftUART.h"
|
#include "SoftUART.h"
|
||||||
|
#include "FileSystem.h"
|
||||||
|
|
||||||
void not_async_actions();
|
void not_async_actions();
|
||||||
|
|
||||||
@@ -66,9 +67,8 @@ void setup() {
|
|||||||
#ifdef SSDP_ENABLED
|
#ifdef SSDP_ENABLED
|
||||||
SsdpInit();
|
SsdpInit();
|
||||||
#endif
|
#endif
|
||||||
|
getFSInfo();
|
||||||
//esp_log_level_set("esp_littlefs", ESP_LOG_NONE);
|
//esp_log_level_set("esp_littlefs", ESP_LOG_NONE);
|
||||||
|
|
||||||
just_load = false;
|
just_load = false;
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user