|
@@ -504,8 +504,8 @@ int AsyncWiFiManager::connectWifi(String ssid, String pass) {
|
|
|
|
|
|
// check if we've got static_ip settings, if we do, use those.
|
|
|
if (_sta_static_ip) {
|
|
|
- DEBUG_WM(F("Custom STA IP/GW/Subnet"));
|
|
|
- WiFi.config(_sta_static_ip, _sta_static_gw, _sta_static_sn);
|
|
|
+ DEBUG_WM(F("Custom STA IP/GW/Subnet/DNS"));
|
|
|
+ WiFi.config(_sta_static_ip, _sta_static_gw, _sta_static_sn, _sta_static_dns1, _sta_static_dns2);
|
|
|
DEBUG_WM(WiFi.localIP());
|
|
|
}
|
|
|
//fix for auto connect racing issue
|
|
@@ -657,10 +657,12 @@ void AsyncWiFiManager::setAPStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress
|
|
|
_ap_static_sn = sn;
|
|
|
}
|
|
|
|
|
|
-void AsyncWiFiManager::setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn) {
|
|
|
+void AsyncWiFiManager::setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn, IPAddress dns1, IPAddress dns2) {
|
|
|
_sta_static_ip = ip;
|
|
|
_sta_static_gw = gw;
|
|
|
_sta_static_sn = sn;
|
|
|
+ _sta_static_dns1 = dns1;
|
|
|
+ _sta_static_dns2 = dns2;
|
|
|
}
|
|
|
|
|
|
void AsyncWiFiManager::setMinimumSignalQuality(int quality) {
|
|
@@ -789,6 +791,24 @@ void AsyncWiFiManager::handleWifi(AsyncWebServerRequest *request,boolean scan) {
|
|
|
|
|
|
page += item;
|
|
|
|
|
|
+ item = FPSTR(HTTP_FORM_PARAM);
|
|
|
+ item.replace("{i}", "dns1");
|
|
|
+ item.replace("{n}", "dns1");
|
|
|
+ item.replace("{p}", "DNS1");
|
|
|
+ item.replace("{l}", "15");
|
|
|
+ item.replace("{v}", _sta_static_dns1.toString());
|
|
|
+
|
|
|
+ page += item;
|
|
|
+
|
|
|
+ item = FPSTR(HTTP_FORM_PARAM);
|
|
|
+ item.replace("{i}", "dns2");
|
|
|
+ item.replace("{n}", "dns2");
|
|
|
+ item.replace("{p}", "DNS2");
|
|
|
+ item.replace("{l}", "15");
|
|
|
+ item.replace("{v}", _sta_static_dns2.toString());
|
|
|
+
|
|
|
+ page += item;
|
|
|
+
|
|
|
page += "<br/>";
|
|
|
}
|
|
|
|
|
@@ -845,6 +865,18 @@ void AsyncWiFiManager::handleWifiSave(AsyncWebServerRequest *request) {
|
|
|
String sn = request->arg("sn");
|
|
|
optionalIPFromString(&_sta_static_sn, sn.c_str());
|
|
|
}
|
|
|
+ if (request->hasArg("dns1")) {
|
|
|
+ DEBUG_WM(F("static DNS 1"));
|
|
|
+ DEBUG_WM(request->arg("dns1"));
|
|
|
+ String dns1 = request->arg("dns1");
|
|
|
+ optionalIPFromString(&_sta_static_dns1, dns1.c_str());
|
|
|
+ }
|
|
|
+ if (request->hasArg("dns2")) {
|
|
|
+ DEBUG_WM(F("static DNS 2"));
|
|
|
+ DEBUG_WM(request->arg("dns2"));
|
|
|
+ String dns2 = request->arg("dns2");
|
|
|
+ optionalIPFromString(&_sta_static_dns2, dns2.c_str());
|
|
|
+ }
|
|
|
|
|
|
String page = FPSTR(WFM_HTTP_HEAD);
|
|
|
page.replace("{v}", "Credentials Saved");
|