added ESP8266 code

This commit is contained in:
lumapu 2022-04-17 01:54:48 +02:00
parent 8030acd283
commit 5f927ad8c5
19 changed files with 1641 additions and 0 deletions

View file

@ -0,0 +1,4 @@
..\tools\fileConv.exe index.html h\index_html.h index_html
..\tools\fileConv.exe setup.html h\setup_html.h setup_html
..\tools\fileConv.exe style.css h\style_css.h style_css
pause

View file

@ -0,0 +1 @@
String index_html = "<!doctype html><html><head><title>Index - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script type=\"text/javascript\"> window.setInterval(\"getAjax('/uptime', 'uptime')\", 1000); window.setInterval(\"getAjax('/time', 'time')\", 1000); function getAjax(url, resid) { var http = null; http = new XMLHttpRequest(); if(http != null) { http.open(\"GET\", url, true); http.onreadystatechange = print; http.send(null); } function print() { if(http.readyState == 4) { document.getElementById(resid).innerHTML = http.responseText; } } } </script></head><body><h1>AHOY - {DEVICE}</h1><div id=\"content\" class=\"content\"><p><a href=\"/update\">Update</a><br/><br/><a href=\"/setup\">Setup</a><br/><a href=\"/reboot\">Reboot</a></p><p><span class=\"des\">Uptime: </span><span id=\"uptime\"></span></p><p><span class=\"des\">Time: </span><span id=\"time\"></span></p></div><div id=\"footer\"><p class=\"left\">&copy 2022</p><p class=\"right\">AHOY :: {VERSION}</p></div></body></html>";

View file

@ -0,0 +1 @@
String setup_html = "<!doctype html><html><head><title>Setup - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"></head><body><h1>Setup</h1><div id=\"setup\" class=\"content\"><div id=\"content\"><p> Enter the credentials to your prefered WiFi station. After rebooting the device tries to connect with this information. </p><form method=\"post\" action=\"/save\"><p class=\"des\">WiFi</p><div class=\"inputWrp\"><input type=\"text\" class=\"inputText\" name=\"ssid\" value=\"{SSID}\" required/><span class=\"floating_label\">SSID</span></div><div class=\"inputWrp\"><input type=\"password\" class=\"inputText\" name=\"pwd\" value=\"{PWD}\" required/><span class=\"floating_label\">PASSWORD</span></div><p class=\"des\">Device Host Name</p><div class=\"inputWrp\"><input type=\"text\" class=\"inputText\" name=\"device\" value=\"{DEVICE}\" required/><span class=\"floating_label\">DEVICE NAME</span></div><p class=\"des\">General</p><div class=\"inputWrp\"><input type=\"text\" class=\"inputText\" name=\"hoy_addr\" value=\"{HOY_ADDR}\" required/><span class=\"floating_label\">HOYMILES ADDRESS (eg. 11:22:33:44:55:66)</span></div><input type=\"checkbox\" class=\"cb\" name=\"reboot\"/><label for=\"reboot\">Reboot device after successful save</label><input type=\"submit\" value=\"save\" class=\"button\" /></form></div></div><div id=\"footer\"><p class=\"left\"><a href=\"/\">Home</a></p><p class=\"left\"><a href=\"/update\">Update Firmware</a></p><p class=\"right\">AHOY - {VERSION}</p></div></body></html>";

View file

@ -0,0 +1 @@
String style_css = "h1 { margin: 0; padding: 20pt; font-size: 22pt; color: #fff; background-color: #006ec0; display: block; text-transform: uppercase; } html, body { font-family: Arial; margin: 0; padding: 0; } p { text-align: justify; font-size: 13pt; } .des { font-size: 14pt; color: #006ec0; padding-bottom: 0px !important; } .fw { width: 60px; display: block; float: left; } .color { width: 50px; height: 50px; border: 1px solid #ccc; } .range { width: 300px; } a:link, a:visited { text-decoration: none; font-size: 13pt; color: #006ec0; } a:hover, a:focus { color: #f00; } #content { padding: 15px 15px 60px 15px; } #footer { position: fixed; bottom: 0px; height: 45px; background-color: #006ec0; width: 100%; } #footer p { color: #fff; padding-left: 20px; padding-right: 20px; font-size: 10pt !important; } #footer a { color: #fff; } #footer a:hover { color: #f00; } div.content { background-color: #fff; padding-bottom: 65px; overflow: hidden; } span.warn { display: inline-block; padding-left: 20px; color: #ff9900; font-style: italic; } input { padding: 10px; font-size: 13pt; } input.button { background-color: #006ec0; color: #fff; border: 0px; float: right; text-transform: uppercase; } input.cb { margin-bottom: 20px; } label { font-size: 14pt; } .left { float: left; } .right { float: right; } .inputWrp { position: relative; } .inputWrp .inputText { height: 35px; width: 90%; margin-bottom: 20px; border: 1px solid #ccc; border-top: none; border-right: none; } .inputWrp .floating_label { position: absolute; pointer-events: none; top: 20px; left: 10px; transition: 0.2s ease all; } .inputWrp input:focus ~ .floating_label, .inputWrp input:not(:focus):valid ~ .floating_label { top: 0px; left: 20px; font-size: 10px; color: blue; opacity: 1; } ";

View file

@ -0,0 +1,45 @@
<!doctype html>
<html>
<head>
<title>Index - {DEVICE}</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
window.setInterval("getAjax('/uptime', 'uptime')", 1000);
window.setInterval("getAjax('/time', 'time')", 1000);
function getAjax(url, resid) {
var http = null;
http = new XMLHttpRequest();
if(http != null) {
http.open("GET", url, true);
http.onreadystatechange = print;
http.send(null);
}
function print() {
if(http.readyState == 4) {
document.getElementById(resid).innerHTML = http.responseText;
}
}
}
</script>
</head>
<body>
<h1>AHOY - {DEVICE}</h1>
<div id="content" class="content">
<p>
<a href="/update">Update</a><br/>
<br/>
<a href="/setup">Setup</a><br/>
<a href="/reboot">Reboot</a>
</p>
<p><span class="des">Uptime: </span><span id="uptime"></span></p>
<p><span class="des">Time: </span><span id="time"></span></p>
</div>
<div id="footer">
<p class="left">&copy 2022</p>
<p class="right">AHOY :: {VERSION}</p>
</div>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<title>Setup - {DEVICE}</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Setup</h1>
<div id="setup" class="content">
<div id="content">
<p>
Enter the credentials to your prefered WiFi station. After rebooting the device tries to connect with this information.
</p>
<form method="post" action="/save">
<p class="des">WiFi</p>
<div class="inputWrp">
<input type="text" class="inputText" name="ssid" value="{SSID}" required/>
<span class="floating_label">SSID</span>
</div>
<div class="inputWrp">
<input type="password" class="inputText" name="pwd" value="{PWD}" required/>
<span class="floating_label">PASSWORD</span>
</div>
<p class="des">Device Host Name</p>
<div class="inputWrp">
<input type="text" class="inputText" name="device" value="{DEVICE}" required/>
<span class="floating_label">DEVICE NAME</span>
</div>
<p class="des">General</p>
<div class="inputWrp">
<input type="text" class="inputText" name="hoy_addr" value="{HOY_ADDR}" required/>
<span class="floating_label">HOYMILES ADDRESS (eg. 11:22:33:44:55:66)</span>
</div>
<input type="checkbox" class="cb" name="reboot"/>
<label for="reboot">Reboot device after successful save</label>
<input type="submit" value="save" class="button" />
</form>
</div>
</div>
<div id="footer">
<p class="left"><a href="/">Home</a></p>
<p class="left"><a href="/update">Update Firmware</a></p>
<p class="right">AHOY - {VERSION}</p>
</div>
</body>
</html>

View file

@ -0,0 +1,151 @@
h1 {
margin: 0;
padding: 20pt;
font-size: 22pt;
color: #fff;
background-color: #006ec0;
display: block;
text-transform: uppercase;
}
html, body {
font-family: Arial;
margin: 0;
padding: 0;
}
p {
text-align: justify;
font-size: 13pt;
}
.des {
font-size: 14pt;
color: #006ec0;
padding-bottom: 0px !important;
}
.fw {
width: 60px;
display: block;
float: left;
}
.color {
width: 50px;
height: 50px;
border: 1px solid #ccc;
}
.range {
width: 300px;
}
a:link, a:visited {
text-decoration: none;
font-size: 13pt;
color: #006ec0;
}
a:hover, a:focus {
color: #f00;
}
#content {
padding: 15px 15px 60px 15px;
}
#footer {
position: fixed;
bottom: 0px;
height: 45px;
background-color: #006ec0;
width: 100%;
}
#footer p {
color: #fff;
padding-left: 20px;
padding-right: 20px;
font-size: 10pt !important;
}
#footer a {
color: #fff;
}
#footer a:hover {
color: #f00;
}
div.content {
background-color: #fff;
padding-bottom: 65px;
overflow: hidden;
}
span.warn {
display: inline-block;
padding-left: 20px;
color: #ff9900;
font-style: italic;
}
input {
padding: 10px;
font-size: 13pt;
}
input.button {
background-color: #006ec0;
color: #fff;
border: 0px;
float: right;
text-transform: uppercase;
}
input.cb {
margin-bottom: 20px;
}
label {
font-size: 14pt;
}
.left {
float: left;
}
.right {
float: right;
}
.inputWrp {
position: relative;
}
.inputWrp .inputText {
height: 35px;
width: 90%;
margin-bottom: 20px;
border: 1px solid #ccc;
border-top: none;
border-right: none;
}
.inputWrp .floating_label {
position: absolute;
pointer-events: none;
top: 20px;
left: 10px;
transition: 0.2s ease all;
}
.inputWrp input:focus ~ .floating_label,
.inputWrp input:not(:focus):valid ~ .floating_label {
top: 0px;
left: 20px;
font-size: 10px;
color: blue;
opacity: 1;
}