This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
serial_monitor.html
144 lines (109 loc) · 5.27 KB
/
serial_monitor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Serial Monitor</title>
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js" type="text/javascript"></script>
<script src="./js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="./js/jquery.gritter.min.js" type="text/javascript"></script>
<script src="./js/jquery.ui.touch-punch.min.js" type="text/javascript"></script>
<script src="./js/ace-elements.min.js" type="text/javascript"></script>
<script src="./js/ace.min.js" type="text/javascript"></script>
<script src="./js/jquery.blockUI.js" type="text/javascript"></script>
<script src="./js/common.js" type="text/javascript"></script>
<script src="./js/bootstrap-datepicker.min.js" type="text/javascript"></script>
<script src="./js/jquery.maskedinput.min.js" type="text/javascript"></script>
<script src="./js/underscore-min.js" type="text/javascript"></script>
<script src="./js/jquery.cookie.js" type="text/javascript"></script>
<script src="./js/jquery.validate.min.js" type="text/javascript"></script>
<script src="./js/jquery.validate.default.js" type="text/javascript"></script>
<script src="./js/jquery.validate.default.js" type="text/javascript"></script>
<script src="./js/sweetalert2.min.js" type="text/javascript"></script>
<script src="./js/jquery.formautofill.js" type="text/javascript"></script>
<script src="./js/alasql.js" type="text/javascript"></script>
<script src="./js/sharelib.js" type="text/javascript"></script>
<script src="./js/axios.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="./css/device.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/bootstrap.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/bootstrap-responsive.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/font-awesome.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/jquery-ui-1.10.3.custom.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/jquery.gritter.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/chosen.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/datepicker.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/ace.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/ace-responsive.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/ace-skins.min.css" type="text/css" media="screen,projection">
<link rel="stylesheet" href="./css/sweetalert2.min.css" type="text/css" media="screen,projection">
<script>
$(document).ready(function () {
async function beginSerial(){
await app.checkPort();
if(portList.length > 0){
$("#port_name").html(portList[0].comName);
port = new SerialPort(portList[0].comName, { baudRate: 115200 });
const parser = new ReadSerialLine();
port.pipe(parser);
parser.on('data', function(line){
$("#tbl_serial tbody").append(`
<tr>
<td>${getTime()}</td>
<td>${line}</td>
</tr>`);
if($("#autoscroll"). prop("checked") == true){
window.scrollTo(0,document.body.scrollHeight);
}
if( $("#tbl_serial tbody tr").length>100){
numRowRemove = $("#tbl_serial tbody tr").length - 100;
for(j=0;j<numRowRemove;j++){
$("#tbl_serial tbody tr").eq(j).remove();
}
}
});//end parser
}else{
swal({type:"error",title:"No device found!"})
}//
}; //end function begin serial
beginSerial();
// (async function(){
// await beginSerial();
// setInterval(function(){
// if(fs.existsSync("./build_in_process")){ //Rom is being built, folder build exists
// port.close();
// port_is_closed = 1;
// $("#tbl_serial tbody").append(`
// <tr>
// <td>${getTime()}</td>
// <td><b class="red">Build & Upload is running! Serial monitor stops and reopens when finish.</b></td>
// </tr>`);
// }else{
// beginSerial();
// }
// },5000);
// })()
$(".btn-serial-clear").click(function(){
$("#tbl_serial tbody").html("");
})
$('.hasTooltip').tooltip({"html": true,"container": "body"});
}); //End document ready
</script>
</head>
<body>
<h3 class="header smaller lighter red">SERIAL MONITOR (DEVICE LOGGING) - PORT: <span id="port_name"></span>
<button type="button" class="btn btn-small btn-warning btn-serial-clear" >Clear</button>
</h3>
<div class="alert alert-block alert-info">For perfomance, only 100 last messsages display</div>
<table style="width: 100%" class="table table-bordered table-condensed" id="tbl_serial">
<thead>
<tr>
<th>Time</th>
<th style="width: 90%">Log</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="alert alert-block">Autoscroll: <input id="autoscroll" type="checkbox" value="1" checked></div>
</body>
</html>