Display configured IP value in setup page

This commit is contained in:
Mathieu Maret 2016-04-07 12:05:37 +02:00
parent 50bf6c7d57
commit e1673f6c22
2 changed files with 6 additions and 6 deletions

View File

@ -65,11 +65,11 @@ void WebHandleSetup() {
"<fieldset>"
"<legend>IP Configuration</legend>"
"<div><input type=\"radio\" name=\"ip_config\" value=\"0\" checked>DHCP <input type=\"radio\" name=\"ip_config\" value=\"1\">Static</div>"
"<div><label for=\"ip\">Ip :</label><br/><input type=\"text\" name=\"ip\" value=\"" + String(ip) + "\" /> </div>"
"<div><label for=\"gw\">Gateway :</label><br/><input type=\"text\" name=\"gw\" value=\"" + String(gw) + "\" /> </div>"
"<div><label for=\"mask\">Netmask :</label><br/><input type=\"text\" name=\"mask\" value=\"" + String(mask) + "\" /> </div>"
"<div><label for=\"mask\">DNS :</label><br/><input type=\"text\" name=\"dns\" value=\"" + String(dns) + "\" /> </div>"
"<div><label for=\"mask\">DNS2 :</label><br/><input type=\"text\" name=\"dns2\" value=\"" + String(dns2) + "\" /> </div>"
"<div><label for=\"ip\">Ip :</label><br/><input type=\"text\" name=\"ip\" value=\"" + (ip == 0 ? "192.168.0.123": IPAddress(ip).toString()) + "\" /> </div>"
"<div><label for=\"gw\">Gateway :</label><br/><input type=\"text\" name=\"gw\" value=\"" + (gw == 0 ? "192.168.0.250": IPAddress(gw).toString()) + "\" /> </div>"
"<div><label for=\"mask\">Netmask :</label><br/><input type=\"text\" name=\"mask\" value=\"" + (mask == 0 ? "255.255.255.0": IPAddress(mask).toString()) + "\" /> </div>"
"<div><label for=\"mask\">DNS :</label><br/><input type=\"text\" name=\"dns\" value=\"" + (dns == 0 ? "192.168.0.250": IPAddress(dns).toString()) + "\" /> </div>"
"<div><label for=\"mask\">DNS2 :</label><br/><input type=\"text\" name=\"dns2\" value=\"" + (dns2 == 0 ? "": IPAddress(dns2).toString()) + "\" /> </div>"
"</fieldset>"
"<fieldset>"
"<legend>MQTT:</legend>"

View File

@ -103,7 +103,7 @@ void WifiSetup(int bootmode, int forceSetup, char *confSsid, char *confPassword,
} else {
SKETCH_DEBUG_PRINTLN("Connecting to Wifi...");
if(ip_config == 1){
SKETCH_DEBUG_PRINTLN("Configure using statis ip");
SKETCH_DEBUG_PRINTLN("Use static ip configuration");
WiFi.config(IPAddress(ip), IPAddress(gw), IPAddress(mask), IPAddress(dns), IPAddress(dns2));
}
WiFi.begin(confSsid, confPassword);