Reboot on network change form.

This commit is contained in:
mattbk 2023-09-27 20:12:38 -05:00
parent 98536b8e76
commit db7c0adfed

View File

@ -134,7 +134,8 @@ const char index_html[] PROGMEM = R"rawliteral(
</script></head><body>
<h1>Vulpes Radio Orienteering Controller</h1>
<p>Local time: <b><span id=local-time-unix></span></b></p>
<p>Local time: <b><span id=local-time-unix></span></b>. If this is incorrect, your browser is not providing the correct time
(<a href="https://support.mozilla.org/en-US/questions/1297208">Firefox example</a>).</p>
<form action="/get" onsubmit="putDate(this);" accept-charset=utf-8>
<h2>General Settings</h2>
@ -188,16 +189,18 @@ const char index_html[] PROGMEM = R"rawliteral(
<br><hr>
<h2>Network Settings</h2>
<form action="/get2" accept-charset=utf-8>
<p>Network Access<br>
AP URL (http, not http<b>s</b>): <a href="http://192.168.0.1">http://192.168.0.1</a><br>
<p>Network Access:
<select name="inputNetwork" id="network">
<option value="0">Access Point</option>
<option value="1">Existing Wireless Network</option>
<option value="1">Existing Wireless Network (advanced)</option>
</select><br>
Existing Network SSID: <input type="text" name="inputSSID" value = "%inputSSID%"><br>
Existing Network Password: <input type="password" name="inputPassword" value = "%inputPassword%"><br>
Existing Wireless Network SSID: <input type="text" name="inputSSID" value = "%inputSSID%"><br>
Existing Wireless Network Password: <input type="password" name="inputPassword" value = "%inputPassword%"><br>
</p><p>
Access Point: Connect to wireless network "vulpes" and point your browser to URL <a href="http://192.168.0.1">http://192.168.0.1</a> (http, not http<b>s</b>)<br>
Existing Network (advanced): Connect to the same existing network and use the proper IP address (useful if you have access to the router or a serial connection).
</p>
<input type="submit" value="Submit"">
<input type="submit" value="Submit and Reboot">
</form>
<iframe style="display:none" name="hidden-form02" id="hidden-form02"></iframe>
@ -289,6 +292,8 @@ String processor(const String& var){
return String();
}
// https://www.thegeekpub.com/276838/how-to-reset-an-arduino-using-code/
void(* resetFunc) (void) = 0; // create a standard reset function
// Set up arduinomorse pin and default WPM
LEDMorseSender sender_blink(blinker, 10.0f); //f makes it a float
@ -594,7 +599,10 @@ void setup() {
yourInputPassword = inputMessage;
Serial.println(yourInputPassword);
}
request->redirect("/");
// Shouldn't need to do this if using this form.
//request->redirect("/");
resetFunc(); // reset the Arduino via software function
});
server.onNotFound(notFound);