mirror of https://github.com/jeelabs/esp-link.git
parent
955f9fc29b
commit
ccd91bd150
@ -1,2 +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= |
||||
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),b=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){}}; |
@ -0,0 +1,30 @@ |
||||
function fetchText(delay) { |
||||
el = $("#console"); |
||||
if (el.textEnd == undefined) { |
||||
el.textEnd = 0; |
||||
el.innerHTML = ""; |
||||
} |
||||
window.setTimeout(function() { |
||||
ajaxJson('GET', console_url + "?start=" + el.textEnd, updateText, retryLoad); |
||||
}, delay); |
||||
} |
||||
|
||||
function updateText(resp) { |
||||
el = $("#console"); |
||||
|
||||
delay = 3000; |
||||
if (resp != null && resp.len > 0) { |
||||
console.log("updateText got", resp.len, "chars at", resp.start); |
||||
if (resp.start > el.textEnd) { |
||||
el.innerHTML = el.innerHTML.concat("\r\n<missing lines\r\n"); |
||||
} |
||||
el.innerHTML = el.innerHTML.concat(resp.text); |
||||
el.textEnd = resp.start + resp.len; |
||||
delay = 500; |
||||
} |
||||
fetchText(delay); |
||||
} |
||||
|
||||
function retryLoad() { |
||||
fetchText(1000); |
||||
} |
@ -1,13 +1,11 @@ |
||||
%head% |
||||
|
||||
<div id="main"> |
||||
<div class="header"> |
||||
<h1><span class="esp">esp</span> link</h1> |
||||
<h2>%version%</h2> |
||||
<h2 id="version"></h2> |
||||
</div> |
||||
|
||||
<div class="content"> |
||||
<p>The ESP Link connects the ESP's serial port to Wifi and it can |
||||
<p>The ESP Link bridges the ESP8266 serial port to Wifi and it can |
||||
program microcontrollers over the serial port, in particular Arduinos, AVRs, and |
||||
NXP's LPC800-series ARM processors.</p> |
||||
</div> |
@ -1,16 +0,0 @@ |
||||
<html><head><title>LED test - ESP Link</title> |
||||
<link rel="stylesheet" type="text/css" href="style.css"> |
||||
</head> |
||||
<body> |
||||
<div id="main"> |
||||
<div id="topnav">%topnav%</div> |
||||
<h1><span class="esp">esp</span> link - LED test</h1> |
||||
<p> |
||||
If there's a LED connected to GPIO2, it's now %ledstate%. You can change that using the buttons below. |
||||
</p> |
||||
<form method="post" action="led.cgi"> |
||||
<input type="submit" name="led" value="1"> |
||||
<input type="submit" name="led" value="0"> |
||||
</form> |
||||
</div> |
||||
</body></html> |
@ -1,44 +0,0 @@ |
||||
<html><head><title>Connecting... - ESP Link</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 getStatus() { |
||||
xhr.open("GET", "connstatus.cgi"); |
||||
xhr.onreadystatechange=function() { |
||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) { |
||||
var data=JSON.parse(xhr.responseText); |
||||
if (data.status=="idle" || data.status=="connecting") { |
||||
$("#status").innerHTML="Connecting..."; |
||||
window.setTimeout(getStatus, 1000); |
||||
} else if (data.status=="got IP address") { |
||||
$("#status").innerHTML="Connected! Got IP "+data.ip+ ".<br/>" + |
||||
"If you're in the same network, you can access it <a href=\"http://"+data.ip+ |
||||
"/\">here</a>.<br/>ESP Link will switch to STA-only mode in a few seconds."; |
||||
} else { |
||||
$("#status").innerHTML="Oops: " + data.status + ". Reason: " + data.reason + |
||||
"<br/>Check password and selected AP.<br/><a href=\"wifi.tpl\">Go Back</a>"; |
||||
} |
||||
} |
||||
} |
||||
xhr.send(); |
||||
} |
||||
|
||||
window.onload=function(e) { |
||||
window.setTimeout(getStatus, 2000); |
||||
}; |
||||
</script> |
||||
</head> |
||||
<body> |
||||
<div id="main"> |
||||
<h1>ESP Link - Connecting</h1> |
||||
<h2>Connecting to AP...</h2> |
||||
<p>Status: |
||||
<span id="status">...</span> |
||||
</p> |
||||
</div> |
||||
</body> |
||||
</html> |
Loading…
Reference in new issue