|
|
@ -9,12 +9,12 @@ |
|
|
|
<p>The Microcontroller console shows the last 1024 characters |
|
|
|
<p>The Microcontroller console shows the last 1024 characters |
|
|
|
received from UART0, to which a microcontroller is typically attached.</p> |
|
|
|
received from UART0, to which a microcontroller is typically attached.</p> |
|
|
|
<p> |
|
|
|
<p> |
|
|
|
<a class="pure-button button-primary" href="#">Reset µC</a> |
|
|
|
<a id="reset-button" class="pure-button button-primary" href="#">Reset µC</a> |
|
|
|
Baud: |
|
|
|
Baud: |
|
|
|
<a href="#" class="pure-button">57600</a> |
|
|
|
<a id="57600-button" href="#" class="pure-button">57600</a> |
|
|
|
<a href="#" class="pure-button">115200</a> |
|
|
|
<a id="115200-button" href="#" class="pure-button">115200</a> |
|
|
|
<a href="#" class="pure-button">230400</a> |
|
|
|
<a id="230400-button" href="#" class="pure-button">230400</a> |
|
|
|
<a href="#" class="pure-button">460800</a> |
|
|
|
<a id="460800-button" href="#" class="pure-button">460800</a> |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
<pre class="console" id="console"></pre> |
|
|
|
<pre class="console" id="console"></pre> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -36,14 +36,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
if(xhr.status !== 200) { |
|
|
|
if(xhr.status !== 200) { |
|
|
|
//console.log("handleEv error cb"); |
|
|
|
//console.log("handleEv error cb"); |
|
|
|
errCb(xhr); |
|
|
|
if (errCb != null) errCb(xhr); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// all is well |
|
|
|
// all is well |
|
|
|
if(xhr.readyState === 4) { |
|
|
|
if(xhr.readyState === 4) { |
|
|
|
//console.log("handleEv success cb"); |
|
|
|
//console.log("handleEv success cb"); |
|
|
|
okCb(xhr, JSON.parse(xhr.responseText)); |
|
|
|
if (okCb != null) okCb(xhr, JSON.parse(xhr.responseText)); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch(e) {return;} |
|
|
|
} catch(e) {return;} |
|
|
|
} |
|
|
|
} |
|
|
@ -59,7 +59,7 @@ |
|
|
|
el.innerHTML = ""; |
|
|
|
el.innerHTML = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
window.setTimeout(function() { |
|
|
|
window.setTimeout(function() { |
|
|
|
loadJSON("/console?start=" + el.textEnd, updateText, retryLoad); |
|
|
|
loadJSON("/console/text?start=" + el.textEnd, updateText, retryLoad); |
|
|
|
}, delay); |
|
|
|
}, delay); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -87,8 +87,28 @@ |
|
|
|
fetchText(1000); |
|
|
|
fetchText(1000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function baudButton(baud) { |
|
|
|
|
|
|
|
document.getElementById(""+baud+"-button").addEventListener("click", function(e) { |
|
|
|
|
|
|
|
console.log("switching to", baud, "baud"); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
loadJSON("/console/baud?rate="+baud); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
window.onload = function() { |
|
|
|
window.onload = function() { |
|
|
|
fetchText(100); |
|
|
|
fetchText(100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById("reset-button").addEventListener("click", function(e) { |
|
|
|
|
|
|
|
el = document.getElementById("console"); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
//console.log("reset click"); |
|
|
|
|
|
|
|
el.innerHTML = ""; |
|
|
|
|
|
|
|
loadJSON("/console/reset"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
baudButton(57600); |
|
|
|
|
|
|
|
baudButton(115200); |
|
|
|
|
|
|
|
baudButton(230400); |
|
|
|
|
|
|
|
baudButton(460800); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
</body></html> |
|
|
|
</body></html> |
|
|
|