mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
@@ -146,6 +146,7 @@ void setup() {
|
|||||||
jsonRead(settingsFlashJson, "pinSDA", pinSDA, false);
|
jsonRead(settingsFlashJson, "pinSDA", pinSDA, false);
|
||||||
jsonRead(settingsFlashJson, "i2cFreq", i2cFreq, false);
|
jsonRead(settingsFlashJson, "i2cFreq", i2cFreq, false);
|
||||||
jsonRead(settingsFlashJson, "i2c", i2c, false);
|
jsonRead(settingsFlashJson, "i2c", i2c, false);
|
||||||
|
jsonWriteStr_(ssidListHeapJson, "0", "Scaning...");
|
||||||
if (i2c != 0) {
|
if (i2c != 0) {
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
Wire.end();
|
Wire.end();
|
||||||
|
|||||||
@@ -177,8 +177,15 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
jsonReadArray(settingsFlashJson, "routerssid", jArray);
|
jsonReadArray(settingsFlashJson, "routerssid", jArray);
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
RouterFind(jArray);
|
RouterFind(jArray);
|
||||||
#endif
|
|
||||||
sendStringToWs("ssidli", ssidListHeapJson, num);
|
sendStringToWs("ssidli", ssidListHeapJson, num);
|
||||||
|
#else
|
||||||
|
//String ssidScan = "{Scaning...}";
|
||||||
|
ssidListHeapJson = "{}";
|
||||||
|
jsonWriteStr_(ssidListHeapJson, "0", "Scaning...");
|
||||||
|
sendStringToWs("ssidli", ssidListHeapJson, num);
|
||||||
|
ScanAsync();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ void IoTItem::checkIntFromNet() {
|
|||||||
if (_intFromNet >= 0) {
|
if (_intFromNet >= 0) {
|
||||||
// если время жизни истекло, то удаляем элемент чуть позже на следующем такте loop
|
// если время жизни истекло, то удаляем элемент чуть позже на следующем такте loop
|
||||||
// если это было уведомление не об ошибке или начале работы, то сообщаем, что сетевое событие давно не приходило
|
// если это было уведомление не об ошибке или начале работы, то сообщаем, что сетевое событие давно не приходило
|
||||||
if (_intFromNet == 0 && _id.indexOf("onError") == -1 && _id.indexOf("onStart") == -1 && _id.indexOf("onInit") == -1) {
|
if (_intFromNet == 0 && _id.indexOf("onError") == -1 && _id.indexOf("onStart") == -1 && _id.indexOf("onInit") == -1 && _id.indexOf("onWifi") == -1) {
|
||||||
SerialPrint("E", _id, "The new data did not come from the network. The level of trust is low.", _id);
|
SerialPrint("E", _id, "The new data did not come from the network. The level of trust is low.", _id);
|
||||||
}
|
}
|
||||||
_intFromNet--;
|
_intFromNet--;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ void WiFiEvent(arduino_event_t *event)
|
|||||||
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
|
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
|
||||||
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
|
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
|
||||||
#endif
|
#endif
|
||||||
|
createItemFromNet("onWifi", "1", 1);
|
||||||
// запускаем MQTT
|
// запускаем MQTT
|
||||||
mqttInit();
|
mqttInit();
|
||||||
SerialPrint("i", F("WIFI"), F("Network Init"));
|
SerialPrint("i", F("WIFI"), F("Network Init"));
|
||||||
@@ -119,7 +120,7 @@ void handleScanResults()
|
|||||||
connectNumNet = i;
|
connectNumNet = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sendStringToWs("ssidli", ssidListHeapJson, -1);
|
||||||
// if
|
// if
|
||||||
}
|
}
|
||||||
SerialPrint("i", "WIFI", "Scan Found: " + ssidListHeapJson);
|
SerialPrint("i", "WIFI", "Scan Found: " + ssidListHeapJson);
|
||||||
@@ -380,7 +381,7 @@ void routerConnect()
|
|||||||
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
|
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
|
||||||
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
|
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
|
||||||
#endif
|
#endif
|
||||||
|
createItemFromNet("onWifi", "1", 1);
|
||||||
mqttInit();
|
mqttInit();
|
||||||
}
|
}
|
||||||
SerialPrint("i", F("WIFI"), F("Network Init"));
|
SerialPrint("i", F("WIFI"), F("Network Init"));
|
||||||
|
|||||||
Reference in New Issue
Block a user