Add libesphttpd to extras and supporting example (#458)
* libesphttpd: added extras and example * Added "heatshrink" as a submodule * Updated libesphttpd * Updated libesphttpd * Trying to fix the commit id * Updated libesphttpd * Added zlib1g-dev package * Use native gcc to build mkespfsimage and mkupgimg * Added NS and GW for DHCP server configuration
This commit is contained in:
parent
d36e9d65a0
commit
09b8b8087c
30 changed files with 1192 additions and 0 deletions
2
examples/esphttpd/html/flash/140medley.min.js
vendored
Normal file
2
examples/esphttpd/html/flash/140medley.min.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
var t=function(a,b){return function(c,d){return a.replace(/#{([^}]*)}/g,function(a,f){return Function("x","with(x)return "+f).call(c,d||b||{})})}},s=function(a,b){return b?{get:function(c){return a[c]&&b.parse(a[c])},set:function(c,d){a[c]=b.stringify(d)}}:{}}(this.localStorage||{},JSON),p=function(a,b,c,d){c=c||document;d=c[b="on"+b];a=c[b]=function(e){d=d&&d(e=e||c.event);return(a=a&&b(e))?b:d};c=this},m=function(a,b,c){b=document;c=b.createElement("p");c.innerHTML=a;for(a=b.createDocumentFragment();b=
|
||||
c.firstChild;)a.appendChild(b);return a},$=function(a,b){a=a.match(/^(\W)?(.*)/);return(b||document)["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2])},j=function(a){for(a=0;a<4;a++)try{return a?new ActiveXObject([,"Msxml2","Msxml3","Microsoft"][a]+".XMLHTTP"):new XMLHttpRequest}catch(b){}};
|
75
examples/esphttpd/html/flash/index.html
Normal file
75
examples/esphttpd/html/flash/index.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<html>
|
||||
<head><title>Upgrade firmware</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<script type="text/javascript" src="140medley.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var xhr=j();
|
||||
|
||||
function doReboot() {
|
||||
xhr.open("GET", "reboot");
|
||||
xhr.onreadystatechange=function() {
|
||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||
window.setTimeout(function() {
|
||||
location.reload(true);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
//ToDo: set timer to
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function setProgress(amt) {
|
||||
$("#progressbarinner").style.width=String(amt*200)+"px";
|
||||
}
|
||||
|
||||
function doUpgrade() {
|
||||
var f=$("#file").files[0];
|
||||
if (typeof f=='undefined') {
|
||||
$("#remark").innerHTML="Can't read file!";
|
||||
return
|
||||
}
|
||||
xhr.open("POST", "upload");
|
||||
xhr.onreadystatechange=function() {
|
||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||
setProgress(1);
|
||||
if (xhr.responseText!="") {
|
||||
$("#remark").innerHTML="Error: "+xhr.responseText;
|
||||
} else {
|
||||
$("#remark").innerHTML="Uploading done. Rebooting.";
|
||||
doReboot();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof xhr.upload.onprogress != 'undefined') {
|
||||
xhr.upload.onprogress=function(e) {
|
||||
setProgress(e.loaded / e.total);
|
||||
}
|
||||
}
|
||||
xhr.send(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
window.onload=function(e) {
|
||||
xhr.open("GET", "next");
|
||||
xhr.onreadystatechange=function() {
|
||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||
var txt="Please upload "+xhr.responseText+" or ota file.";
|
||||
$("#remark").innerHTML=txt;
|
||||
setProgress(0);
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
<h1>Update firmware</h1>
|
||||
<div id="remark">Loading...</div>
|
||||
<input type="file" id="file" />
|
||||
<input type="submit" value="Upgrade!" onclick="doUpgrade()" />
|
||||
<div id="progressbar"><div id="progressbarinner"></div></div>
|
||||
</body>
|
34
examples/esphttpd/html/flash/style.css
Normal file
34
examples/esphttpd/html/flash/style.css
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
body {
|
||||
background-color: #404040;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #d0d0FF;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
border: 2px solid #000000;
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px
|
||||
}
|
||||
|
||||
#progressbar {
|
||||
margin: 10px;
|
||||
padding: 0;
|
||||
border: 1px solid #000000;
|
||||
height: 20px;
|
||||
width: 200px;
|
||||
background-color: #808080;
|
||||
}
|
||||
|
||||
#progressbarinner {
|
||||
width: 10px;
|
||||
height: 20px;
|
||||
border: none;
|
||||
background-color: #00ff00;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue