убираем баги окна ввода даты

This commit is contained in:
Dmitry Borisenko
2022-09-11 14:13:58 +02:00
parent 9c5624eddf
commit d121414e65
5 changed files with 17 additions and 15 deletions

View File

@@ -222,7 +222,7 @@ boolean publishData(const String& topic, const String& data) {
return true;
}
boolean publishChart(const String& topic, const String& data) {
boolean publishChartMqtt(const String& topic, const String& data) {
String path = mqttRootDevice + "/" + topic + "/status";
if (!publish(path, data)) {
SerialPrint("E", F("MQTT"), F("on publish chart"));

View File

@@ -59,7 +59,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
sendFileToWs("/layout.json", num, 1024);
String json = getParamsJson();
standWebSocket.sendTXT(num, json);
//отправка данных графиков
//отправка данных графиков (нехватает передачи номера сокетов)
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getSubtype() == "Loging") {
(*it)->sendChart(2);
@@ -250,8 +250,8 @@ void publishStatusWs(const String& topic, const String& data) {
}
//публикация статус сообщений уже готовых
void publishStatusWsJson(String& json) {
standWebSocket.broadcastTXT(json);
void publishChartWs(String& data) {
standWebSocket.broadcastTXT(data);
}
//данные которые мы отправляем в сокеты переодически

View File

@@ -5,7 +5,6 @@
void *getAPI_Date(String params);
String date;
class Loging : public IoTItem {
private:
String logid;
@@ -158,7 +157,7 @@ class Loging : public IoTItem {
// SerialPrint("i", F("Loging"), "file '" + buf + "' too old, deleted");
// removeFile(buf);
//} else {
unsigned long reqUnixTime = strDateToUnix(date);
unsigned long reqUnixTime = strDateToUnix(getItemValue(id + "-date"));
if (fileUnixTimeLocal > reqUnixTime && fileUnixTimeLocal < reqUnixTime + 86400) {
noData = false;
createJson(buf, i, type);
@@ -229,12 +228,12 @@ class Loging : public IoTItem {
void publishJson(String &oneSingleJson, int type) {
if (type == 1) {
publishChart(id, oneSingleJson);
publishChartMqtt(id, oneSingleJson);
} else if (type == 2) {
publishStatusWsJson(oneSingleJson);
publishChartWs(oneSingleJson);
} else if (type == 3) {
publishChart(id, oneSingleJson);
publishStatusWsJson(oneSingleJson);
publishChartMqtt(id, oneSingleJson);
publishChartWs(oneSingleJson);
}
}
@@ -257,7 +256,7 @@ class Loging : public IoTItem {
generateEvent(_id, value);
publishStatusMqtt(_id, value);
String json = createSingleJson(_id, value);
publishStatusWsJson(json);
publishChartWs(json);
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
}
@@ -298,16 +297,19 @@ class Date : public IoTItem {
void setValue(String valStr) {
value.valS = valStr;
date = valStr;
setValue(value);
}
void setValue(IoTValue Value) {
value = Value;
regEvent(value.valS, "");
//отправка данных при изменении даты
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getSubtype() == "Loging") {
(*it)->sendChart(3);
//отправляем только свои данные
if ((*it)->getID() == selectToMarker(id, "-")) {
(*it)->sendChart(3);
}
}
}
}