-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
346 additions
and
46 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
void HandleRoot() | ||
{ | ||
if (server.hasArg("prop1")) | ||
{ | ||
handleCredentials(); | ||
} | ||
else | ||
{ | ||
server.send(200, "text/html", GetPage0()); | ||
} | ||
} | ||
|
||
void HandlePage1() | ||
{ | ||
// switches | ||
server.send(200, "text/html", GetPage1()); | ||
} | ||
|
||
void HandlePage2() | ||
{ | ||
// network | ||
server.send(200, "text/html", GetPage2()); | ||
} | ||
|
||
void handleCredentials() | ||
{ | ||
int NewID; | ||
int Interval; | ||
|
||
server.arg("prop1").toCharArray(MDL.SSID, sizeof(MDL.SSID) - 1); | ||
server.arg("prop2").toCharArray(MDL.Password, sizeof(MDL.Password) - 1); | ||
MDL.WifiMode = 1; | ||
|
||
server.send(200, "text/html", GetPage0()); | ||
|
||
SaveData(); | ||
|
||
delay(3000); | ||
|
||
ESP.restart(); | ||
} | ||
|
||
void ButtonPressed() | ||
{ | ||
if (server.arg("Btn") == "Master") | ||
{ | ||
WifiMasterOn = !WifiMasterOn; | ||
WifiSwitchesTimer = millis(); | ||
HandlePage1(); | ||
} | ||
else | ||
{ | ||
int ID = server.arg("Btn").toInt() - 1; | ||
if (ID >= 0 && ID < 16) | ||
{ | ||
Button[ID] = !Button[ID]; | ||
WifiSwitchesTimer = millis(); | ||
HandlePage1(); | ||
} | ||
} | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
|
||
String GetPage2() | ||
{ | ||
String st = "<HTML>"; | ||
st += ""; | ||
st += " <head>"; | ||
st += " <META content='text/html; charset=utf-8' http-equiv=Content-Type>"; | ||
st += " <meta name=vs_targetSchema content='HTML 4.0'>"; | ||
st += " <meta name='viewport' content='width=device-width, initial-scale=1.0'>"; | ||
st += " <title>Wifi AOG</title>"; | ||
st += " <style>"; | ||
st += " html {"; | ||
st += " font-family: Helvetica;"; | ||
st += " display: inline-block;"; | ||
st += " margin: 0px auto;"; | ||
st += " text-align: center;"; | ||
st += ""; | ||
st += " }"; | ||
st += ""; | ||
st += " h1 {"; | ||
st += " color: #444444;"; | ||
st += " margin: 50px auto 30px;"; | ||
st += " }"; | ||
st += ""; | ||
st += " table.center {"; | ||
st += " margin-left: auto;"; | ||
st += " margin-right: auto;"; | ||
st += " }"; | ||
st += ""; | ||
st += " .button-72 {"; | ||
st += " align-items: center;"; | ||
st += " background-color: initial;"; | ||
st += " background-image: linear-gradient(rgba(179, 132, 201, .84), rgba(57, 31, 91, .84) 50%);"; | ||
st += " border-radius: 42px;"; | ||
st += " border-width: 0;"; | ||
st += " box-shadow: rgba(57, 31, 91, 0.24) 0 2px 2px, rgba(179, 132, 201, 0.4) 0 8px 12px;"; | ||
st += " color: #FFFFFF;"; | ||
st += " cursor: pointer;"; | ||
st += " display: flex;"; | ||
st += " font-family: Quicksand, sans-serif;"; | ||
st += " font-size: 18px;"; | ||
st += " font-weight: 700;"; | ||
st += " justify-content: center;"; | ||
st += " letter-spacing: .04em;"; | ||
st += " line-height: 16px;"; | ||
st += " margin: auto;"; | ||
st += " padding: 18px 18px;"; | ||
st += " text-align: center;"; | ||
st += " text-decoration: none;"; | ||
st += " text-shadow: rgba(255, 255, 255, 0.4) 0 0 4px, rgba(255, 255, 255, 0.2) 0 0 12px, rgba(57, 31, 91, 0.6) 1px 1px 4px, rgba(57, 31, 91, 0.32) 4px 4px 16px;"; | ||
st += " user-select: none;"; | ||
st += " -webkit-user-select: none;"; | ||
st += " touch-action: manipulation;"; | ||
st += " vertical-align: baseline;"; | ||
st += " width: 40%"; | ||
st += " }"; | ||
st += ""; | ||
st += " .InputCell {"; | ||
st += " text-align: center;"; | ||
st += " font-size: 18px;"; | ||
st += " font-weight: 700;"; | ||
st += " }"; | ||
st += ""; | ||
st += " a:link {"; | ||
st += " font-size: 150%;"; | ||
st += " }"; | ||
st += ""; | ||
st += " </style>"; | ||
st += " </head>"; | ||
st += ""; | ||
st += " <BODY>"; | ||
st += " <style>"; | ||
st += " body {"; | ||
st += " margin-top: 50px;"; | ||
st += " background-color: wheat"; | ||
st += " }"; | ||
st += ""; | ||
st += " font-family: Arial,"; | ||
st += " Helvetica,"; | ||
st += " Sans-Serif;"; | ||
st += ""; | ||
st += " </style>"; | ||
st += ""; | ||
st += " <h1 align=center>Wifi Network </h1>"; | ||
st += " <form id=FORM1 method=post action='/'> "; | ||
st += " <table class='center'>"; | ||
st += ""; | ||
st += " <tr>"; | ||
st += " <td align='left'>Network</td>"; | ||
st += " <td><input class='InputCell' size='20' name='prop1' value='" + String(MDL.SSID) + "' ID=Text1></td>"; | ||
st += " </tr>"; | ||
st += ""; | ||
st += " <tr>"; | ||
st += " <td align='left'>Password</td>"; | ||
st += " <td><input class='InputCell' size='20' name='prop2' value='" + String(MDL.Password) + "' ID=Text2></td>"; | ||
st += " </tr>"; | ||
st += " </table>"; | ||
st += ""; | ||
st += " <p> <input class='button-72' id=Submit1 type=submit value='Save/Restart'></p>"; | ||
st += " <p> <a href='/page0'>Back</a> </p>"; | ||
st += " </form>"; | ||
if (WiFi.isConnected()) | ||
{ | ||
st += "<p>Wifi Connected to " + String(MDL.SSID) + "</p>"; | ||
} | ||
else | ||
{ | ||
st += "<p>Wifi Not Connected</p>"; | ||
} | ||
//st += "<P>Debug</p>"; | ||
//st += "<p>" + String(debug1) + "</p>"; | ||
//st += "<p>" + String(debug2) + "</p>"; | ||
//st += "<p>" + String(debug3) + "</p>"; | ||
st += "</body>"; | ||
st += ""; | ||
st += "</HTML>"; | ||
|
||
return st; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
|
||
String GetPage0() | ||
{ | ||
String st = "<HTML>"; | ||
st += ""; | ||
st += " <head>"; | ||
st += " <META content='text/html; charset=utf-8' http-equiv=Content-Type>"; | ||
st += " <meta name=vs_targetSchema content='HTML 4.0'>"; | ||
st += " <meta name='viewport' content='width=device-width, initial-scale=1.0'>"; | ||
st += " <title>Wifi AOG</title>"; | ||
st += " <style>"; | ||
st += " html {"; | ||
st += " font-family: Helvetica;"; | ||
st += " display: inline-block;"; | ||
st += " margin: 0px auto;"; | ||
st += " text-align: center;"; | ||
st += ""; | ||
st += " }"; | ||
st += ""; | ||
st += " h1 {"; | ||
st += " color: #444444;"; | ||
st += " margin: 50px auto 30px;"; | ||
st += " }"; | ||
st += ""; | ||
st += " table.center {"; | ||
st += " margin-left: auto;"; | ||
st += " margin-right: auto;"; | ||
st += " }"; | ||
st += ""; | ||
st += " .buttonOn {"; | ||
st += " background-color: #00ff00;"; | ||
st += " border: none;"; | ||
st += " color: white;"; | ||
st += " padding: 15px 32px;"; | ||
st += " text-align: center;"; | ||
st += " text-decoration: none;"; | ||
st += " display: inline-block;"; | ||
st += " margin: 4px 2px;"; | ||
st += " cursor: pointer;"; | ||
st += " font-size: 15px;"; | ||
st += " width: 30%;"; | ||
st += " }"; | ||
st += ""; | ||
st += " .buttonOff {"; | ||
st += " background-color: #ff0000;"; | ||
st += " border: none;"; | ||
st += " color: white;"; | ||
st += " padding: 15px 32px;"; | ||
st += " text-align: center;"; | ||
st += " text-decoration: none;"; | ||
st += " display: inline-block;"; | ||
st += " margin: 4px 2px;"; | ||
st += " cursor: pointer;"; | ||
st += " font-size: 15px;"; | ||
st += " width: 30%;"; | ||
st += " }"; | ||
st += ""; | ||
st += " .button-72 {"; | ||
st += " align-items: center;"; | ||
st += " background-color: initial;"; | ||
st += " background-image: linear-gradient(rgba(179, 132, 201, .84), rgba(57, 31, 91, .84) 50%);"; | ||
st += " border-radius: 42px;"; | ||
st += " border-width: 0;"; | ||
st += " box-shadow: rgba(57, 31, 91, 0.24) 0 2px 2px, rgba(179, 132, 201, 0.4) 0 8px 12px;"; | ||
st += " color: #FFFFFF;"; | ||
st += " cursor: pointer;"; | ||
st += " display: flex;"; | ||
st += " font-family: Quicksand, sans-serif;"; | ||
st += " font-size: 18px;"; | ||
st += " font-weight: 700;"; | ||
st += " justify-content: center;"; | ||
st += " letter-spacing: .04em;"; | ||
st += " line-height: 16px;"; | ||
st += " margin: auto;"; | ||
st += " padding: 18px 18px;"; | ||
st += " text-align: center;"; | ||
st += " text-decoration: none;"; | ||
st += " text-shadow: rgba(255, 255, 255, 0.4) 0 0 4px, rgba(255, 255, 255, 0.2) 0 0 12px, rgba(57, 31, 91, 0.6) 1px 1px 4px, rgba(57, 31, 91, 0.32) 4px 4px 16px;"; | ||
st += " user-select: none;"; | ||
st += " -webkit-user-select: none;"; | ||
st += " touch-action: manipulation;"; | ||
st += " vertical-align: baseline;"; | ||
st += " width:30%"; | ||
st += " }"; | ||
st += ""; | ||
st += " .InputCell {"; | ||
st += " text-align: center;"; | ||
st += " }"; | ||
st += ""; | ||
st += " </style>"; | ||
st += " </head>"; | ||
st += ""; | ||
st += " <BODY>"; | ||
st += " <style>"; | ||
st += " body {"; | ||
st += " margin-top: 50px;"; | ||
st += " background-color: wheat"; | ||
st += " }"; | ||
st += ""; | ||
st += " font-family: Arial,"; | ||
st += " Helvetica,"; | ||
st += " Sans-Serif;"; | ||
st += ""; | ||
st += " </style>"; | ||
st += ""; | ||
st += " <h1 align=center>RC_ESP32"; | ||
st += " </h1>"; | ||
st += " <form id=FORM1 method=post action='/'> "; | ||
st += ""; | ||
st += ""; | ||
st += " <p> <a class='button-72' href='/page1' >Switches</a> </p>"; | ||
st += " <p> <a class='button-72' href='/page2' >Network</a> </p>"; | ||
st += ""; | ||
st += " </form>"; | ||
st += ""; | ||
st += "</HTML>"; | ||
|
||
return st; | ||
} | ||
|
Oops, something went wrong.