mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-06-10 11:59:19 +03:00
стабильное логгирование
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,17 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
|
||||
<title>IoT Manager 4.1.8</title>
|
||||
<title>IoT Manager 4.1.9</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.ico'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||
<link rel="stylesheet" href="/build/bundle.css" />
|
||||
|
||||
<script defer src='/build/bundle.js'></script>
|
||||
</head>
|
||||
<script defer src="/build/bundle.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
<body></body>
|
||||
</html>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef esp32_4mb
|
||||
#define USE_LITTLEFS false
|
||||
#define USE_LITTLEFS true
|
||||
#endif
|
||||
|
||||
#define START_DATETIME 1640995200 // 01.01.2022 00:00:00 константа для сокращения unix time
|
||||
|
||||
@@ -12,4 +12,5 @@ extern const String filepath(const String& filename);
|
||||
extern bool cutFile(const String& src, const String& dst);
|
||||
extern size_t countLines(const String filename);
|
||||
void removeFile(const String& filename);
|
||||
void cleanDirectory(String path);
|
||||
extern void onFlashWrite();
|
||||
@@ -134,5 +134,6 @@ build_src_filter =
|
||||
+<modules\exec\Mcp23017>
|
||||
+<modules\exec\Mp3>
|
||||
+<modules\exec\Pwm32>
|
||||
+<modules\exec\SysExt>
|
||||
+<modules\display\Lcd2004>
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
||||
if (headerStr == "/reboot|") {
|
||||
ESP.restart();
|
||||
}
|
||||
//команда обновления esp//
|
||||
if (headerStr == "/update|") {
|
||||
upgrade_firmware(3);
|
||||
//команда очистки всех логов esp//
|
||||
if (headerStr == "/clean|") {
|
||||
cleanDirectory("logs");
|
||||
}
|
||||
|
||||
//Прием сообщений cotrol ==============================================================================
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "NTP.h"
|
||||
|
||||
//раскомментировать если нужна цельная выгрузка графиков
|
||||
//#define SOLID_UPLOADING
|
||||
#define SOLID_UPLOADING
|
||||
|
||||
class Loging : public IoTItem {
|
||||
private:
|
||||
@@ -177,16 +177,6 @@ class Loging : public IoTItem {
|
||||
publishChart(id, oneSingleJson);
|
||||
}
|
||||
|
||||
void cleanLog() {
|
||||
String directory = "logs/" + id;
|
||||
auto dir = FileFS.openDir(directory);
|
||||
while (dir.next()) {
|
||||
String fname = dir.fileName();
|
||||
removeFile(directory + "/" + fname);
|
||||
SerialPrint("I", "Loging " + id, fname + " deleted");
|
||||
}
|
||||
}
|
||||
|
||||
int calculateMaxCount() {
|
||||
return 86400 / interval;
|
||||
}
|
||||
|
||||
@@ -190,6 +190,17 @@ void removeFile(const String& filename) {
|
||||
}
|
||||
}
|
||||
|
||||
//очищаем директорию с файлами
|
||||
void cleanDirectory(String path) {
|
||||
auto dir = FileFS.openDir(path);
|
||||
while (dir.next()) {
|
||||
String fname = dir.fileName();
|
||||
removeFile(path + "/" + fname);
|
||||
SerialPrint("I", "Files", fname + " deleted");
|
||||
}
|
||||
onFlashWrite();
|
||||
}
|
||||
|
||||
//счетчик количества записей на флешь за сеанс
|
||||
void onFlashWrite() {
|
||||
flashWriteNumber++;
|
||||
|
||||
Reference in New Issue
Block a user