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

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": {
"*.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 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="stylesheet" href="/build/bundle.css" />

View File

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

View File

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

View File

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

View File

@@ -95,11 +95,13 @@ void IoTItem::regEvent(String value, String consoleInfo = "") {
generateEvent(_id, value);
publishStatusMqtt(_id, value);
// проверка если global установлен то шлем всем о событии
if (_global) {
SerialPrint("i", F("=>ALLMQTT"), "Broadcast event: ");
}
publishStatusWs(_id, value);
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
// проверка если global установлен то шлем всем о событии
// if (_global) {
// SerialPrint("i", F("=>ALLMQTT"), "Broadcast event: ");
// }
//отправка события другим устройствам в сети==============================
// if (jsonReadBool(settingsFlashJson, "mqttin")) {
// String json = "{}";
@@ -110,8 +112,6 @@ void IoTItem::regEvent(String value, String consoleInfo = "") {
// 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 = "") {

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() {
//если объект логгирования не был создан
if (!isItemExist(logid)) {
@@ -63,7 +72,7 @@ class Loging : public IoTItem {
return;
}
// regEvent(value, F("Loging"));
regEvent(value, F("Loging"));
String logData = String(unixTimeShort) + " " + value;
@@ -154,7 +163,6 @@ class Loging : public IoTItem {
int i = 0;
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))) {
@@ -164,6 +172,7 @@ class Loging : public IoTItem {
createJson(buf, i, mqtt);
}
SerialPrint("i", F("Loging"), String(f) + ") path: " + buf + ", lines №: " + String(i) + ", created: " + getDateTimeDotFormatedFromUnix(fileUnixTime));
filesList = deleteBeforeDelimiter(filesList, ";");
}
}
@@ -282,9 +291,9 @@ class Loging : public IoTItem {
}
}
//примерный подсчет максимального количества точек
//просто максимальное количество точек
int calculateMaxCount() {
return 86400 / interval;
return 86400;
}
};

View File

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