Merge pull request #239 from biveraxe/ver4dev

Вафля через get и ошибки в Uart
This commit is contained in:
2022-11-15 23:06:28 +03:00
committed by GitHub
3 changed files with 20 additions and 3 deletions

View File

@@ -38,6 +38,22 @@ void standWebServerInit() {
// HTTP.send(200, "text/plain", "ok");
// });
HTTP.on("/set", HTTP_GET, []() {
if (HTTP.hasArg(F("routerssid")) && WiFi.getMode() == WIFI_AP) {
jsonWriteStr(settingsFlashJson, F("routerssid"), HTTP.arg(F("routerssid")));
syncSettingsFlashJson();
HTTP.send(200, "text/plain", "ok");
}
if (HTTP.hasArg(F("routerpass")) && WiFi.getMode() == WIFI_AP) {
jsonWriteStr(settingsFlashJson, F("routerpass"), HTTP.arg(F("routerpass")));
syncSettingsFlashJson();
HTTP.send(200, "text/plain", "ok");
}
});
// Добавляем функцию Update для перезаписи прошивки по WiFi при 1М(256K FileFS) и выше
// httpUpdater.setup(&HTTP);

View File

@@ -29,7 +29,7 @@
"esp8266_4mb": 15
},
"title": "Cенсор температуры ds18b20",
"moduleDesc": "Позволяет получить значения температуры с Ds18b20.",
"moduleDesc": "Позволяет получить значения температуры с Ds18b20. О подделках: https://github.com/cpetrich/counterfeit_DS18B20",
"propInfo": {
"pin": "GPIO номер, к которому подключена шина данных датчиков.",
"index": "Порядковый номер датчика на шине.",

View File

@@ -106,6 +106,7 @@ class UART : public IoTItem {
case 2: // формат событий для Nextion ID=Value0xFF0xFF0xFF
printStr += eventItem->getID();
int indexOf_ = printStr.indexOf("_");
//Serial.println(printStr + " fff " + indexOf_);
if (indexOf_ == -1) return; // пропускаем событие, если нет используемого признака типа данных - _txt или _vol
if (printStr.indexOf("_txt") > 0) {
@@ -113,11 +114,11 @@ class UART : public IoTItem {
printStr += eventItem->getValue();
printStr += "\"";
} else if (printStr.indexOf("_val") > 0) {
printStr += eventItem->getValue();
printStr.replace(".", "");
printStr.replace("_val", ".val=");
printStr += eventItem->getValue();
} else {
if (indexOf_ == printStr.length()) printStr.replace("_", "");
if (indexOf_ == printStr.length()-1) printStr.replace("_", "");
else printStr.replace("_", ".");
printStr += "=";
printStr += eventItem->getValue();