mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-03 04:05:55 +02:00
added time to serial console
This commit is contained in:
parent
8ae78842a8
commit
c32927a94e
1 changed files with 11 additions and 4 deletions
|
@ -17,6 +17,8 @@
|
|||
<p class="right" id="version"></p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var printTime = true;
|
||||
|
||||
function parseSys(obj) {
|
||||
document.getElementById("version").innerHTML = "Git SHA: " + obj["build"] + " :: " + obj["version"];
|
||||
}
|
||||
|
@ -35,10 +37,15 @@
|
|||
}, false);
|
||||
|
||||
source.addEventListener('serial', function(e) {
|
||||
//var ascii = "";
|
||||
//for(i = 0; i < e.data.length; i++)
|
||||
// ascii += e.data.charCodeAt(i).toString(16) + " ";
|
||||
//console.log(ascii);
|
||||
if(printTime) {
|
||||
var d = new Date();
|
||||
con.value += d.toLocaleTimeString() + ": ";
|
||||
printTime = false;
|
||||
}
|
||||
|
||||
if(e.data.includes('<rn>'))
|
||||
printTime = true;
|
||||
|
||||
con.value += e.data.replace(/\<rn\>/g, '\r\n');
|
||||
con.scrollTop = con.scrollHeight;
|
||||
}, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue