mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-04-05 16:49:25 +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>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'>
|
<meta charset="utf-8" />
|
||||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
<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="icon" type="image/png" href="/favicon.ico" />
|
||||||
<link rel='stylesheet' href='/build/bundle.css'>
|
<link rel="stylesheet" href="/build/bundle.css" />
|
||||||
|
|
||||||
<script defer src='/build/bundle.js'></script>
|
<script defer src="/build/bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body></body>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef esp32_4mb
|
#ifdef esp32_4mb
|
||||||
#define USE_LITTLEFS false
|
#define USE_LITTLEFS true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define START_DATETIME 1640995200 // 01.01.2022 00:00:00 константа для сокращения unix time
|
#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 bool cutFile(const String& src, const String& dst);
|
||||||
extern size_t countLines(const String filename);
|
extern size_t countLines(const String filename);
|
||||||
void removeFile(const String& filename);
|
void removeFile(const String& filename);
|
||||||
|
void cleanDirectory(String path);
|
||||||
extern void onFlashWrite();
|
extern void onFlashWrite();
|
||||||
@@ -134,5 +134,6 @@ build_src_filter =
|
|||||||
+<modules\exec\Mcp23017>
|
+<modules\exec\Mcp23017>
|
||||||
+<modules\exec\Mp3>
|
+<modules\exec\Mp3>
|
||||||
+<modules\exec\Pwm32>
|
+<modules\exec\Pwm32>
|
||||||
|
+<modules\exec\SysExt>
|
||||||
+<modules\display\Lcd2004>
|
+<modules\display\Lcd2004>
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
if (headerStr == "/reboot|") {
|
if (headerStr == "/reboot|") {
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
//команда обновления esp//
|
//команда очистки всех логов esp//
|
||||||
if (headerStr == "/update|") {
|
if (headerStr == "/clean|") {
|
||||||
upgrade_firmware(3);
|
cleanDirectory("logs");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Прием сообщений cotrol ==============================================================================
|
//Прием сообщений cotrol ==============================================================================
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "NTP.h"
|
#include "NTP.h"
|
||||||
|
|
||||||
//раскомментировать если нужна цельная выгрузка графиков
|
//раскомментировать если нужна цельная выгрузка графиков
|
||||||
//#define SOLID_UPLOADING
|
#define SOLID_UPLOADING
|
||||||
|
|
||||||
class Loging : public IoTItem {
|
class Loging : public IoTItem {
|
||||||
private:
|
private:
|
||||||
@@ -177,16 +177,6 @@ class Loging : public IoTItem {
|
|||||||
publishChart(id, oneSingleJson);
|
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() {
|
int calculateMaxCount() {
|
||||||
return 86400 / interval;
|
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() {
|
void onFlashWrite() {
|
||||||
flashWriteNumber++;
|
flashWriteNumber++;
|
||||||
|
|||||||
Reference in New Issue
Block a user