Add option to set up for wifi or AP on compile #53

Merged
W1CDN merged 9 commits from access-point into main 2023-10-01 11:29:23 -05:00
Showing only changes of commit db7c0adfed - Show all commits

View File

@ -134,7 +134,8 @@ const char index_html[] PROGMEM = R"rawliteral(
</script></head><body> </script></head><body>
<h1>Vulpes Radio Orienteering Controller</h1> <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> <form action="/get" onsubmit="putDate(this);" accept-charset=utf-8>
<h2>General Settings</h2> <h2>General Settings</h2>
@ -188,16 +189,18 @@ const char index_html[] PROGMEM = R"rawliteral(
<br><hr> <br><hr>
<h2>Network Settings</h2> <h2>Network Settings</h2>
<form action="/get2" accept-charset=utf-8> <form action="/get2" accept-charset=utf-8>
<p>Network Access<br> <p>Network Access:
AP URL (http, not http<b>s</b>): <a href="http://192.168.0.1">http://192.168.0.1</a><br>
<select name="inputNetwork" id="network"> <select name="inputNetwork" id="network">
<option value="0">Access Point</option> <option value="0">Access Point</option>
<option value="1">Existing Wireless Network</option> <option value="1">Existing Wireless Network (advanced)</option>
</select><br> </select><br>
Existing Network SSID: <input type="text" name="inputSSID" value = "%inputSSID%"><br> Existing Wireless Network SSID: <input type="text" name="inputSSID" value = "%inputSSID%"><br>
Existing Network Password: <input type="password" name="inputPassword" value = "%inputPassword%"><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> </p>
<input type="submit" value="Submit""> <input type="submit" value="Submit and Reboot">
</form> </form>
<iframe style="display:none" name="hidden-form02" id="hidden-form02"></iframe> <iframe style="display:none" name="hidden-form02" id="hidden-form02"></iframe>
@ -289,6 +292,8 @@ String processor(const String& var){
return String(); 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 // Set up arduinomorse pin and default WPM
LEDMorseSender sender_blink(blinker, 10.0f); //f makes it a float LEDMorseSender sender_blink(blinker, 10.0f); //f makes it a float
@ -594,7 +599,10 @@ void setup() {
yourInputPassword = inputMessage; yourInputPassword = inputMessage;
Serial.println(yourInputPassword); 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); server.onNotFound(notFound);