From dc34ef00f9de680a81fb51431927a06f88d7dd39 Mon Sep 17 00:00:00 2001 From: rjwats Date: Mon, 8 Mar 2021 00:13:29 +0000 Subject: [PATCH] quick fix for ip address issue under esp32 with latest espressif (#230) --- lib/framework/WiFiSettingsService.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/framework/WiFiSettingsService.h b/lib/framework/WiFiSettingsService.h index 3d1dc22..b979c9c 100644 --- a/lib/framework/WiFiSettingsService.h +++ b/lib/framework/WiFiSettingsService.h @@ -24,6 +24,8 @@ #define WIFI_RECONNECTION_DELAY 1000 * 30 +const IPAddress IP_NOT_SET = IPAddress(INADDR_NONE); + class WiFiSettings { public: // core wifi configuration @@ -68,7 +70,7 @@ class WiFiSettings { JsonUtils::readIP(root, "dns_ip_2", settings.dnsIP2); // Swap around the dns servers if 2 is populated but 1 is not - if (settings.dnsIP1 == INADDR_NONE && settings.dnsIP2 != INADDR_NONE) { + if (settings.dnsIP1 == IP_NOT_SET && settings.dnsIP2 != IP_NOT_SET) { settings.dnsIP1 = settings.dnsIP2; settings.dnsIP2 = INADDR_NONE; } @@ -77,7 +79,7 @@ class WiFiSettings { // of ipAddress, gateway and subnet. This may change to static ip only // as sensible defaults can be assumed for gateway and subnet if (settings.staticIPConfig && - (settings.localIP == INADDR_NONE || settings.gatewayIP == INADDR_NONE || settings.subnetMask == INADDR_NONE)) { + (settings.localIP == IP_NOT_SET || settings.gatewayIP == IP_NOT_SET || settings.subnetMask == IP_NOT_SET)) { settings.staticIPConfig = false; } return StateUpdateResult::CHANGED;