исправление всех багов графиков

This commit is contained in:
Dmitry Borisenko
2022-09-08 23:35:19 +02:00
parent 5e8120086b
commit fff7c976a9
10 changed files with 35 additions and 19 deletions

View File

@@ -1,6 +1,13 @@
{ {
"files.associations": { "files.associations": {
"*.tcc": "cpp", "*.tcc": "cpp",
"fstream": "cpp" "fstream": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"array": "cpp",
"functional": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp"
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@
<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.2.2</title> <title>IoT Manager 4.2.3</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" />

View File

@@ -13,7 +13,7 @@
"id": "log", "id": "log",
"widget": "chart1", "widget": "chart1",
"page": "Графики", "page": "Графики",
"descr": "График", "descr": "Температура",
"int": 1, "int": 1,
"logid": "t", "logid": "t",
"num": 1, "num": 1,

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
//Версия прошивки //Версия прошивки
#define FIRMWARE_VERSION 416 #define FIRMWARE_VERSION 417
#ifdef esp8266_4mb #ifdef esp8266_4mb
#define FIRMWARE_NAME "esp8266_4mb" #define FIRMWARE_NAME "esp8266_4mb"

View File

@@ -20,8 +20,8 @@ class IoTItem {
virtual void doByInterval(); virtual void doByInterval();
virtual IoTValue execute(String command, std::vector<IoTValue>& param); virtual IoTValue execute(String command, std::vector<IoTValue>& param);
void regEvent(String value, String consoleInfo); virtual void regEvent(String value, String consoleInfo);
void regEvent(float value, String consoleInfo); virtual void regEvent(float value, String consoleInfo);
String getSubtype(); String getSubtype();
virtual void sendChart(bool mqtt); virtual void sendChart(bool mqtt);

View File

@@ -95,11 +95,13 @@ void IoTItem::regEvent(String value, String consoleInfo = "") {
generateEvent(_id, value); generateEvent(_id, value);
publishStatusMqtt(_id, value); publishStatusMqtt(_id, value);
// проверка если global установлен то шлем всем о событии publishStatusWs(_id, value);
if (_global) { SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
SerialPrint("i", F("=>ALLMQTT"), "Broadcast event: ");
}
// проверка если global установлен то шлем всем о событии
// if (_global) {
// SerialPrint("i", F("=>ALLMQTT"), "Broadcast event: ");
// }
//отправка события другим устройствам в сети============================== //отправка события другим устройствам в сети==============================
// if (jsonReadBool(settingsFlashJson, "mqttin")) { // if (jsonReadBool(settingsFlashJson, "mqttin")) {
// String json = "{}"; // String json = "{}";
@@ -110,8 +112,6 @@ void IoTItem::regEvent(String value, String consoleInfo = "") {
// SerialPrint("i", F("<=MQTT"), "Broadcast event: " + json); // SerialPrint("i", F("<=MQTT"), "Broadcast event: " + json);
//} //}
//======================================================================== //========================================================================
publishStatusWs(_id, value); // Ilya, data: "1" (analog sensor, round set to 1, should be "1.0")
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
} }
void IoTItem::regEvent(float regvalue, String consoleInfo = "") { void IoTItem::regEvent(float regvalue, String consoleInfo = "") {

View File

@@ -43,6 +43,15 @@ class Loging : public IoTItem {
} }
} }
void regEvent(String value, String consoleInfo = "") {
generateEvent(_id, value);
publishStatusMqtt(_id, value);
String topic = mqttRootDevice + "/" + _id;
String json = "{\"topic\":\"" + topic + "\",\"status\":[{\"x\":" + String(unixTime) + ",\"y1\":" + value + "}]}";
publishStatusWsJson(json);
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
}
void doByInterval() { void doByInterval() {
//если объект логгирования не был создан //если объект логгирования не был создан
if (!isItemExist(logid)) { if (!isItemExist(logid)) {
@@ -63,7 +72,7 @@ class Loging : public IoTItem {
return; return;
} }
// regEvent(value, F("Loging")); regEvent(value, F("Loging"));
String logData = String(unixTimeShort) + " " + value; String logData = String(unixTimeShort) + " " + value;
@@ -154,7 +163,6 @@ class Loging : public IoTItem {
int i = 0; int i = 0;
unsigned long fileUnixTime = selectToMarkerLast(deleteToMarkerLast(buf, "."), "/").toInt() + START_DATETIME; unsigned long fileUnixTime = selectToMarkerLast(deleteToMarkerLast(buf, "."), "/").toInt() + START_DATETIME;
SerialPrint("i", F("Loging"), String(f) + ") path: " + buf + ", lines №: " + String(i) + ", creation time: " + getDateTimeDotFormatedFromUnix(fileUnixTime));
//удаление старых файлов //удаление старых файлов
if ((fileUnixTime + (points * (interval / 1000))) < (unixTime - (keepdays * 86400))) { if ((fileUnixTime + (points * (interval / 1000))) < (unixTime - (keepdays * 86400))) {
@@ -164,6 +172,7 @@ class Loging : public IoTItem {
createJson(buf, i, mqtt); createJson(buf, i, mqtt);
} }
SerialPrint("i", F("Loging"), String(f) + ") path: " + buf + ", lines №: " + String(i) + ", created: " + getDateTimeDotFormatedFromUnix(fileUnixTime));
filesList = deleteBeforeDelimiter(filesList, ";"); filesList = deleteBeforeDelimiter(filesList, ";");
} }
} }
@@ -282,9 +291,9 @@ class Loging : public IoTItem {
} }
} }
//примерный подсчет максимального количества точек //просто максимальное количество точек
int calculateMaxCount() { int calculateMaxCount() {
return 86400 / interval; return 86400;
} }
}; };

View File

@@ -8,7 +8,7 @@
"id": "log", "id": "log",
"widget": "chart1", "widget": "chart1",
"page": "Графики", "page": "Графики",
"descr": "График", "descr": "Температура",
"int": 1, "int": 1,
"logid": "t", "logid": "t",
"num": 1, "num": 1,