mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-04 12:45:54 +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>
|
<p class="right" id="version"></p>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var printTime = true;
|
||||||
|
|
||||||
function parseSys(obj) {
|
function parseSys(obj) {
|
||||||
document.getElementById("version").innerHTML = "Git SHA: " + obj["build"] + " :: " + obj["version"];
|
document.getElementById("version").innerHTML = "Git SHA: " + obj["build"] + " :: " + obj["version"];
|
||||||
}
|
}
|
||||||
|
@ -35,10 +37,15 @@
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
source.addEventListener('serial', function(e) {
|
source.addEventListener('serial', function(e) {
|
||||||
//var ascii = "";
|
if(printTime) {
|
||||||
//for(i = 0; i < e.data.length; i++)
|
var d = new Date();
|
||||||
// ascii += e.data.charCodeAt(i).toString(16) + " ";
|
con.value += d.toLocaleTimeString() + ": ";
|
||||||
//console.log(ascii);
|
printTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e.data.includes('<rn>'))
|
||||||
|
printTime = true;
|
||||||
|
|
||||||
con.value += e.data.replace(/\<rn\>/g, '\r\n');
|
con.value += e.data.replace(/\<rn\>/g, '\r\n');
|
||||||
con.scrollTop = con.scrollHeight;
|
con.scrollTop = con.scrollHeight;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue