From 2babe036a7004cc2c21aa581de02e747adb307a4 Mon Sep 17 00:00:00 2001 From: Paulo Nascimento Date: Thu, 23 Jan 2020 23:33:33 -0300 Subject: [PATCH 1/2] Save DNS when using static IP --- src/BrewPiLess.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BrewPiLess.cpp b/src/BrewPiLess.cpp index 3f3b2933f..8860022b5 100644 --- a/src/BrewPiLess.cpp +++ b/src/BrewPiLess.cpp @@ -1395,6 +1395,7 @@ class NetworkConfig:public AsyncWebHandler syscfg->ip = ip; syscfg->gw = gw; syscfg->netmask = nm; + syscfg->dns = dns; theSettings.save(); }else{ WiFiSetup.connect(ssid.c_str(),pass); From f463ca05d876e4060592016cb6d8275cfefcd061 Mon Sep 17 00:00:00 2001 From: Paulo Nascimento Date: Thu, 23 Jan 2020 23:55:48 -0300 Subject: [PATCH 2/2] Use static dns when connecting to wifi if static ip is being used --- src/WiFiSetup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WiFiSetup.cpp b/src/WiFiSetup.cpp index aea89ed7f..5466ead69 100644 --- a/src/WiFiSetup.cpp +++ b/src/WiFiSetup.cpp @@ -20,7 +20,7 @@ WiFiSetupClass WiFiSetup; #endif #if SerialDebug -#define wifi_info(a) DBG_PRINTF("%s,SSID:%s pass:%s IP:%s, gw:%s\n",(a),WiFi.SSID().c_str(),WiFi.psk().c_str(),WiFi.localIP().toString().c_str(),WiFi.gatewayIP().toString().c_str()) +#define wifi_info(a) DBG_PRINTF("%s,SSID:%s pass:%s IP:%s, gw:%s, dns:%s\n",(a),WiFi.SSID().c_str(),WiFi.psk().c_str(),WiFi.localIP().toString().c_str(),WiFi.gatewayIP().toString().c_str(),WiFi.dnsIP().toString().c_str()) #else #define wifi_info(a) #endif @@ -97,7 +97,7 @@ void WiFiSetupClass::begin(WiFiMode mode, char const *ssid,const char *passwd) if( mode2use == WIFI_STA || mode2use == WIFI_AP_STA){ if(_ip !=INADDR_NONE){ - WiFi.config(_ip,_gw,_nm); + WiFi.config(_ip,_gw,_nm,_dns); }else{ // the weird printout of "[NO IP]" implies that explicitly specification of DHCP // might be necessary.