Created
February 28, 2018 20:09
-
-
Save msraynsford/ccd22623b5ac8fe69d5a8c080f77b54c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If the passwords match we can update the config with the new settings | |
// Check to see if there is a new value (also doubles to check the length of the new value is long enough) | |
if(webServer.arg("newpassword").length() > 7) | |
webServer.arg("newpassword").toCharArray(config.password, sizeof(config.password)); | |
if(webServer.arg("newssid").length() > 7) | |
webServer.arg("newssid").toCharArray(config.ssid, sizeof(config.ssid)); | |
// Store the new settings to EEPROM | |
EEPROM_writeAnything(0, config); | |
EEPROM.commit(); | |
// Construct a message to tell the user that the change worked | |
message = "New settings will take effect after restart"; | |
Serial.println(message); | |
// Reply with a web page to indicate success or failure | |
message = "<html><head><meta http-equiv='refresh' content='5;url=/' /></head><body><h1>" + message; | |
message += "<br/>Redirecting in 5 seconds...</h1></body></html>"; | |
webServer.send(200, "text/html", message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment