Minor changes
This commit is contained in:
parent
028894a8cb
commit
70181f56f0
@ -50,7 +50,7 @@ String mqttUserLogin{""};
|
|||||||
String mqttUserPassword{""};
|
String mqttUserPassword{""};
|
||||||
String topicPrefix{"homeassistant"};
|
String topicPrefix{"homeassistant"};
|
||||||
|
|
||||||
bool isWasConnectionToWifi{false};
|
bool wasConnectionToWifi{false};
|
||||||
|
|
||||||
ZHNetwork myNet;
|
ZHNetwork myNet;
|
||||||
AsyncWebServer webServer(80);
|
AsyncWebServer webServer(80);
|
||||||
@ -470,14 +470,14 @@ void connectToWifi()
|
|||||||
{
|
{
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (WiFi.status() == WL_CONNECTED)
|
||||||
{
|
{
|
||||||
isWasConnectionToWifi = true;
|
wasConnectionToWifi = true;
|
||||||
wifiReconnectTimer.detach();
|
wifiReconnectTimer.detach();
|
||||||
mqttClient.connect();
|
mqttClient.connect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (WiFi.status() == WL_CONNECT_FAILED)
|
if (WiFi.status() == WL_CONNECT_FAILED)
|
||||||
{
|
{
|
||||||
if (!isWasConnectionToWifi)
|
if (!wasConnectionToWifi)
|
||||||
{
|
{
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_AP);
|
||||||
WiFi.softAP(("ESP-NOW Gateway " + myNet.getNodeMac()).c_str(), "12345678");
|
WiFi.softAP(("ESP-NOW Gateway " + myNet.getNodeMac()).c_str(), "12345678");
|
||||||
@ -492,7 +492,7 @@ void connectToWifi()
|
|||||||
WiFi.mode(WIFI_OFF); // Without rebooting WiFi stops working ESP-NOW.
|
WiFi.mode(WIFI_OFF); // Without rebooting WiFi stops working ESP-NOW.
|
||||||
myNet.begin(espnowNetName.c_str());
|
myNet.begin(espnowNetName.c_str());
|
||||||
}
|
}
|
||||||
if (!isWasConnectionToWifi)
|
if (!wasConnectionToWifi)
|
||||||
{
|
{
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_AP);
|
||||||
WiFi.softAP(("ESP-NOW Gateway " + myNet.getNodeMac()).c_str(), "12345678");
|
WiFi.softAP(("ESP-NOW Gateway " + myNet.getNodeMac()).c_str(), "12345678");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user