mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-17 00:21:31 +10:00
Merge pull request #365 from vyruz1986/master
Allow showing static IP config without predefined value
This commit is contained in:
+9
-7
@@ -138,15 +138,17 @@ void WiFiManager::setupConfigPortal() {
|
||||
|
||||
}
|
||||
|
||||
boolean WiFiManager::autoConnect() {
|
||||
boolean WiFiManager::autoConnect(boolean showStaticIPFields) {
|
||||
String ssid = "ESP" + String(ESP.getChipId());
|
||||
return autoConnect(ssid.c_str(), NULL);
|
||||
return autoConnect(ssid.c_str(), NULL, showStaticIPFields);
|
||||
}
|
||||
|
||||
boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
boolean WiFiManager::autoConnect(char const *apName, char const *apPassword, boolean showStaticIPFields) {
|
||||
DEBUG_WM(F(""));
|
||||
DEBUG_WM(F("AutoConnect"));
|
||||
|
||||
_sta_show_static_fields = showStaticIPFields;
|
||||
|
||||
// read eeprom for ssid and pass
|
||||
//String ssid = getSSID();
|
||||
//String pass = getPassword();
|
||||
@@ -532,14 +534,14 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
page += "<br/>";
|
||||
}
|
||||
|
||||
if (_sta_static_ip) {
|
||||
if (_sta_show_static_fields || _sta_static_ip) {
|
||||
|
||||
String item = FPSTR(HTTP_FORM_PARAM);
|
||||
item.replace("{i}", "ip");
|
||||
item.replace("{n}", "ip");
|
||||
item.replace("{p}", "Static IP");
|
||||
item.replace("{l}", "15");
|
||||
item.replace("{v}", _sta_static_ip.toString());
|
||||
item.replace("{v}", (_sta_static_ip ? _sta_static_ip.toString() : ""));
|
||||
|
||||
page += item;
|
||||
|
||||
@@ -548,7 +550,7 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
item.replace("{n}", "gw");
|
||||
item.replace("{p}", "Static Gateway");
|
||||
item.replace("{l}", "15");
|
||||
item.replace("{v}", _sta_static_gw.toString());
|
||||
item.replace("{v}", (_sta_static_gw ? _sta_static_gw.toString() : ""));
|
||||
|
||||
page += item;
|
||||
|
||||
@@ -557,7 +559,7 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
item.replace("{n}", "sn");
|
||||
item.replace("{p}", "Subnet");
|
||||
item.replace("{l}", "15");
|
||||
item.replace("{v}", _sta_static_sn.toString());
|
||||
item.replace("{v}", (_sta_static_sn ? _sta_static_sn.toString() : ""));
|
||||
|
||||
page += item;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user