diff --git a/data/config.json b/data/config.json index 5e722090..1e32fc2a 100644 --- a/data/config.json +++ b/data/config.json @@ -3,8 +3,8 @@ "chipID": "", "apssid": "IoTmanager", "appass": "", - "routerssid": "WLAN1-Y1GYEF", - "routerpass": "2egY69YTA8DDR7En", + "routerssid": "rise", + "routerpass": "hostel3333", "timezone": 1, "ntp": "pool.ntp.org", "mqttServer": "91.204.228.124", @@ -25,11 +25,12 @@ "webpass": "admin", "MqttIn": "0", "MqttOut": "0", - "blink": "1", + "blink": "0", "oneWirePin": "2", "serverip": "http://206.189.49.244", "uart": "0", "uartS": "9600", "uartTX": "12", - "uartRX": "13" + "uartRX": "13", + "grafmax": "0" } \ No newline at end of file diff --git a/data/index.json.gz b/data/index.json.gz index 8c2326ef..1ba12d45 100644 Binary files a/data/index.json.gz and b/data/index.json.gz differ diff --git a/data/set.dev.json.gz b/data/set.dev.json.gz index a4df323d..547ae998 100644 Binary files a/data/set.dev.json.gz and b/data/set.dev.json.gz differ diff --git a/data_ungzip/index.json b/data_ungzip/index.json index 6141ccdd..a520b982 100644 --- a/data_ungzip/index.json +++ b/data_ungzip/index.json @@ -42,6 +42,12 @@ "action": "/?set.utilities", "class": "btn btn-block btn-default" }, + { + "type": "link", + "title": "Настройки разработчика", + "action": "/?set.dev", + "class": "btn btn-block btn-default" + }, { "type": "link", "title": "Скачать приложение IoT Manager для android", diff --git a/data_ungzip/set.dev.json b/data_ungzip/set.dev.json index 4815eb95..6a96ef14 100644 --- a/data_ungzip/set.dev.json +++ b/data_ungzip/set.dev.json @@ -39,6 +39,25 @@ { "type": "hr" }, + { + "type": "h3", + "title": "Количество точек графика выгружаемое за раз" + }, + { + "type": "input", + "title": "ip address", + "name": "graf-arg", + "state": "{{grafmax}}" + }, + { + "type": "button", + "title": "{{ButSave}}", + "action": "set?grafmax=[[graf-arg]]", + "class": "btn btn-block btn-default" + }, + { + "type": "hr" + }, { "type": "h3", "name": "reset-block", diff --git a/include/Class/ScenarioClass3.h b/include/Class/ScenarioClass3.h index 13937370..9c72a0a8 100644 --- a/include/Class/ScenarioClass3.h +++ b/include/Class/ScenarioClass3.h @@ -29,7 +29,7 @@ class Scenario { String setEventSign = selectFromMarkerToMarker(condition, " ", 1); String setEventValue = selectFromMarkerToMarker(condition, " ", 2); - if (!isDigitStr(setEventValue)) { + if (!isDigitDotCommaStr(setEventValue)) { if (setEventValue.indexOf("+-") != -1) { String setEventValueName = selectToMarker(setEventValue, "+-"); String gisteresisValue = selectToMarkerLast(setEventValue, "+-"); diff --git a/src/Tests.cpp b/src/Tests.cpp index b274c711..7ba1141c 100644 --- a/src/Tests.cpp +++ b/src/Tests.cpp @@ -11,7 +11,7 @@ void testsPerform() { //Serial.println(isDigitDotCommaStr("-12552.5555")); //String str = "Geeks for Geeks "; - // + //Serial.println(itemsCount2(str, " ")); Serial.println("==========end============"); diff --git a/src/Web.cpp b/src/Web.cpp index 0d531755..a1ed35ea 100644 --- a/src/Web.cpp +++ b/src/Web.cpp @@ -325,13 +325,20 @@ void web_init() { serverIP = jsonReadStr(configSetupJson, "serverip"); request->send(200); } - //set?order=button_1 + //set?order=button_1 if (request->hasArg("order")) { String order = request->getParam("order")->value(); - order.replace("_"," "); + order.replace("_", " "); orderBuf += order + ","; request->send(200); } + + if (request->hasArg("grafmax")) { + int value = request->getParam("grafmax")->value().toInt(); + jsonWriteInt(configSetupJson, "grafmax", value); + saveConfig(); + request->send(200); + } }); server.on("/order", HTTP_GET, [](AsyncWebServerRequest* request) { @@ -345,8 +352,6 @@ void web_init() { String msg = ""; if (USE_OTA) { - msg = F("Обновление невозможно, память устройства 1 мб"); - } else { if (lastVersion == FIRMWARE_VERSION) { msg = F("Актуальная версия прошивки уже установлена."); } else if (lastVersion > FIRMWARE_VERSION) { @@ -358,6 +363,8 @@ void web_init() { } else if (lastVersion < FIRMWARE_VERSION) { msg = F("Ошибка версии. Попробуйте повторить позже..."); } + } else { + msg = F("Обновление невозможно, память устройства 1 мб"); } String tmp = "{}"; diff --git a/src/items/vLogging.cpp b/src/items/vLogging.cpp index cff4371d..56f02735 100644 --- a/src/items/vLogging.cpp +++ b/src/items/vLogging.cpp @@ -36,8 +36,8 @@ void LoggingClass::execute(String keyOrValue) { } else { SerialPrint("E", "Logging", "This value not found on this device"); } - } else { //прилетело из события - if (isDigitStr(keyOrValue) || keyOrValue.indexOf(".") != -1) { //если это число или дробное число + } else { //прилетело из события + if (isDigitDotCommaStr(keyOrValue)) { //если это число или дробное число loggingValue = keyOrValue; } else { //если это ключ if (getValue(_loggingValueKey) != "no value") { @@ -49,21 +49,22 @@ void LoggingClass::execute(String keyOrValue) { } String filename = "logs/" + _key + ".txt"; - + size_t cnt = countLines(filename); size_t sz = getFileSize(filename); - SerialPrint("I", "Logging", "http://" + WiFi.localIP().toString() + "/" + filename + " lines " + String(cnt, DEC) + ", size " + String(sz) + ", heap " + ESP.getFreeHeap()); + SerialPrint("I", "Logging", "http://" + WiFi.localIP().toString() + "/" + filename + " lines " + String(cnt, DEC) + ", size " + String(sz)); if ((cnt > _maxPoints + 1) || cnt == -1) { - removeFile(filename); + removeFile(filename); SerialPrint("E", "Logging", "file been remooved: " + filename + " " + String(cnt) + ">" + String(_maxPoints)); cnt = 0; } if (loggingValue != "") { - if (cnt > _maxPoints) { //удаляем старую строку и добавляем новую - String logData = readFile(filename, 10240); + if (cnt > _maxPoints) { //удаляем старую строку и добавляем новую + String logData = readFile(filename, 20480); //10240 + SerialPrint("I", "Logging", "Free heap " + ESP.getFreeHeap()); if (logData == "large") { SerialPrint("E", "Logging", "File is very large"); } @@ -132,39 +133,6 @@ void choose_log_date_and_send() { } } -void sendLogData2(String file, String topic) { - String log_date = readFile(file, 5120); - if (log_date != "failed") { - log_date.replace("\r\n", "\n"); - log_date.replace("\r", "\n"); - String buf = "{}"; - String json_array; - String unix_time; - String value; - while (log_date.length()) { - String tmp = selectToMarker(log_date, "\n"); - log_date = deleteBeforeDelimiter(log_date, "\n"); - unix_time = selectToMarker(tmp, " "); - jsonWriteInt(buf, "x", unix_time.toInt()); - value = deleteBeforeDelimiter(tmp, " "); - jsonWriteFloat(buf, "y1", value.toFloat()); - if (log_date.length() < 3) { - json_array += buf; - } else { - json_array += buf + ","; - } - buf = "{}"; - } - unix_time = ""; - value = ""; - log_date = ""; - json_array = "{\"status\":[" + json_array + "]}"; - //SerialPrint("I", "module", json_array); - - publishChart(topic, json_array); - } -} - void sendLogData(String file, String topic) { File configFile = FileFS.open(file, "r"); if (!configFile) { @@ -189,12 +157,15 @@ void sendLogData(String file, String topic) { if (unix_time != "" || value != "") { json_array += buf + ","; } - if (i >= 100) { - json_array = "{\"status\":[" + json_array + "]}"; - json_array.replace("},]}", "}]}"); - publishChart(topic, json_array); - json_array = ""; - i = 0; + int grafmax = jsonReadInt(configSetupJson, "grafmax"); + if (grafmax != 0) { + if (i >= grafmax) { + json_array = "{\"status\":[" + json_array + "]}"; + json_array.replace("},]}", "}]}"); + publishChart(topic, json_array); + json_array = ""; + i = 0; + } } } while (psn < sz);