update arduino/Betas/RGB_V1.1.1/main/data/index.html.

增加debug功能
master
慕炎 2022-01-02 16:10:45 +00:00 committed by Gitee
parent 99cea11f51
commit b97158bc08
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 57 additions and 36 deletions

View File

@ -1,4 +1,4 @@
<!-- <!--
自平衡莱洛三角形 RGB版 自平衡莱洛三角形 RGB版
HW:Ver 1.5 HW:Ver 1.5
FW:Ver 1.2 FW:Ver 1.2
@ -126,34 +126,42 @@ function UpdateInfo()
document.getElementById('TimeDiv').innerHTML=arr[0]; document.getElementById('TimeDiv').innerHTML=arr[0];
document.getElementById('CurrentMillis').innerHTML=arr[1]; document.getElementById('CurrentMillis').innerHTML=arr[1];
document.getElementById('log_control').value==arr[2];
document.getElementById('BAT_VOLTAGE').innerHTML=arr[2]; document.getElementById('debug_log_control').value==arr[3];
document.getElementById('BAT_VOLTAGE').innerHTML=arr[4];
if(document.getElementById('log_control').value=="1"){ if(document.getElementById('log_control').value=="1"){
document.getElementById('Shaft_Velocity').innerHTML =arr[3]+"<br>"+document.getElementById('Shaft_Velocity').innerHTML; document.getElementById('Shaft_Velocity').innerHTML =arr[5]+"<br>"+document.getElementById('Shaft_Velocity').innerHTML;
document.getElementById('motor_voltage_q').innerHTML=arr[4]+"<br>"+document.getElementById('motor_voltage_q').innerHTML; document.getElementById('motor_voltage_q').innerHTML=arr[6]+"<br>"+document.getElementById('motor_voltage_q').innerHTML;
document.getElementById('target_velocity').innerHTML=arr[5]+"<br>"+document.getElementById('target_velocity').innerHTML; document.getElementById('target_velocity').innerHTML=arr[7]+"<br>"+document.getElementById('target_velocity').innerHTML;
document.getElementById('pendulum_angle').innerHTML=arr[6]+"<br>"+document.getElementById('pendulum_angle').innerHTML; document.getElementById('pendulum_angle').innerHTML=arr[8]+"<br>"+document.getElementById('pendulum_angle').innerHTML;
document.getElementById('target_angle').innerHTML=arr[7]+"<br>"+document.getElementById('target_angle').innerHTML; document.getElementById('target_angle').innerHTML=arr[9]+"<br>"+document.getElementById('target_angle').innerHTML;
document.getElementById('kalAngleZ').innerHTML=arr[8]+"<br>"+document.getElementById('kalAngleZ').innerHTML; document.getElementById('kalAngleZ').innerHTML=arr[10]+"<br>"+document.getElementById('kalAngleZ').innerHTML;
document.getElementById('gyroZrate').innerHTML=arr[9]+"<br>"+document.getElementById('gyroZrate').innerHTML; document.getElementById('gyroZrate').innerHTML=arr[11]+"<br>"+document.getElementById('gyroZrate').innerHTML;
} }
document.getElementById('target_angle_ROM').innerHTML=arr[10]; document.getElementById('target_angle_ROM').innerHTML=arr[12];
document.getElementById('swing_up_voltage').innerHTML=arr[11]; document.getElementById('swing_up_voltage').innerHTML=arr[13];
document.getElementById('swing_up_angle').innerHTML=arr[12]; document.getElementById('swing_up_angle').innerHTML=arr[14];
document.getElementById('v_i_1').innerHTML=arr[13]; document.getElementById('v_i_1').innerHTML=arr[15];
document.getElementById('v_p_1').innerHTML=arr[14]; document.getElementById('v_p_1').innerHTML=arr[16];
document.getElementById('v_i_2').innerHTML=arr[15]; document.getElementById('v_i_2').innerHTML=arr[17];
document.getElementById('v_p_2').innerHTML=arr[16]; document.getElementById('v_p_2').innerHTML=arr[18];
if(document.getElementById('target_angle_ROM2').value=="") document.getElementById('target_angle_ROM2').value=arr[10]; if(document.getElementById('target_angle_ROM2').value=="") document.getElementById('target_angle_ROM2').value=arr[12];
if(document.getElementById('swing_up_voltage2').value=="") document.getElementById('swing_up_voltage2').value=arr[11]; if(document.getElementById('swing_up_voltage2').value=="") document.getElementById('swing_up_voltage2').value=arr[13];
if(document.getElementById('swing_up_angle2').value=="") document.getElementById('swing_up_angle2').value=arr[12]; if(document.getElementById('swing_up_angle2').value=="") document.getElementById('swing_up_angle2').value=arr[14];
if(document.getElementById('v_i_12').value=="") document.getElementById('v_i_12').value=arr[13]; if(document.getElementById('v_i_12').value=="") document.getElementById('v_i_12').value=arr[15];
if(document.getElementById('v_p_12').value=="") document.getElementById('v_p_12').value=arr[14]; if(document.getElementById('v_p_12').value=="") document.getElementById('v_p_12').value=arr[16];
if(document.getElementById('v_i_22').value=="") document.getElementById('v_i_22').value=arr[15]; if(document.getElementById('v_i_22').value=="") document.getElementById('v_i_22').value=arr[17];
if(document.getElementById('v_p_22').value=="") document.getElementById('v_p_22').value=arr[16]; if(document.getElementById('v_p_22').value=="") document.getElementById('v_p_22').value=arr[18];
if(document.getElementById('debug_log_control').value=="1"){
document.getElementById('debug_log').style.display='block';
document.getElementById('debug_log').value += arr[19];
}else{
document.getElementById('debug_log').style.display='none';
}
} }
} }
xmlhttp.open("GET",'/update',true); xmlhttp.open("GET",'/update',true);
@ -176,6 +184,10 @@ function UpdateInfo()
document.getElementById('kalAngleZ').innerHTML =""; document.getElementById('kalAngleZ').innerHTML ="";
document.getElementById('gyroZrate').innerHTML =""; document.getElementById('gyroZrate').innerHTML ="";
} }
function clearDebugLog()
{
document.getElementById('debug_log').value ="";
}
function checkNum(obj) { function checkNum(obj) {
//检查是否是非数字值 //检查是否是非数字值
@ -199,10 +211,11 @@ function checkNum(obj) {
<div id="TimeDiv" hidden>datetime</div> <div id="TimeDiv" hidden>datetime</div>
</font> </font>
</div> </div>
<div id="OperationHit"><h2></h2></div>
<table border="0"> <table border="0">
<tr> <tr>
<td height="50">已启动:<span id=CurrentMillis></span> &nbsp;&nbsp;&nbsp;&nbsp;电池电压:<span id="BAT_VOLTAGE" style="color:#de87b8;"></span> V <td height="50">已启动:<span id=CurrentMillis></span>
&nbsp;&nbsp;&nbsp;&nbsp;电池电压:<span id="BAT_VOLTAGE" style="color:#de87b8;"></span> V
<span id="OperationHit"></span>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -275,6 +288,17 @@ function checkNum(obj) {
</table> </table>
</td> </td>
</tr> </tr>
<tr>
<td>
<button type="button" onclick="document.getElementById('debug_log_control').value=1;loadXMLDoc('/Control?Type=0&Index=6&Operation=1','OperationHit');document.getElementById('debug_log').style.display='block';">Debug</button>
<button type="button" onclick="document.getElementById('debug_log_control').value=0;loadXMLDoc('/Control?Type=0&Index=6&Operation=0','OperationHit');document.getElementById('debug_log').style.display='none';">关闭Debug</button>
<button type="button" onclick="clearDebugLog()">清除记录</button>
<input type="hidden" name="debug_log_control" id="debug_log_control">
</td>
</tr>
<tr>
<td align="left"><textarea name="debug_log" rows="10" cols="80" id="debug_log" style="display:none"></textarea></td>
</tr>
<tr> <tr>
<td height="50"> <td height="50">
<button type="button" onclick="document.getElementById('loglist').style.display='block';">显示记录</button> <button type="button" onclick="document.getElementById('loglist').style.display='block';">显示记录</button>
@ -282,7 +306,7 @@ function checkNum(obj) {
<button type="button" onclick="clearLog()">清除记录</button> <button type="button" onclick="clearLog()">清除记录</button>
<button type="button" onclick="document.getElementById('log_control').value=1;loadXMLDoc('/Control?Type=0&Index=5&Operation=1','OperationHit')">开启记录</button> <button type="button" onclick="document.getElementById('log_control').value=1;loadXMLDoc('/Control?Type=0&Index=5&Operation=1','OperationHit')">开启记录</button>
<button type="button" onclick="document.getElementById('log_control').value=0;loadXMLDoc('/Control?Type=0&Index=5&Operation=0','OperationHit')">停止记录</button> <button type="button" onclick="document.getElementById('log_control').value=0;loadXMLDoc('/Control?Type=0&Index=5&Operation=0','OperationHit')">停止记录</button>
<input type="hidden" name="log_control" id="log_control" value="1"> <input type="hidden" name="log_control" id="log_control">
</td> </td>
</tr> </tr>
<tr> <tr>
@ -290,12 +314,12 @@ function checkNum(obj) {
<table border="1" cellspacing="0" cellpadding="0" ID="loglist" width="100%"> <table border="1" cellspacing="0" cellpadding="0" ID="loglist" width="100%">
<tr> <tr>
<td align="center"><span style="color:#ff5c5c;">Shaft Velocity</span></td> <td align="center"><span style="color:#ff5c5c;">Shaft Velocity</span></td>
<td align="center"><span style="color:#398ad9;">motor voltage q</span></td> <td align="center"><span style="color:#398ad9;">motor voltage q</span></td>
<td align="center"><span style="color:#ff5c5c;">target_velocity</span></td> <td align="center"><span style="color:#ff5c5c;">target_velocity</span></td>
<td align="center"><span style="color:#5bec8d;">pendulum_angle</span></td> <td align="center"><span style="color:#5bec8d;">pendulum_angle</span></td>
<td align="center"><span style="color:#fd42ac;">target_angle</span></td> <td align="center"><span style="color:#fd42ac;">target_angle</span></td>
<td align="center"><span style="color:#ff33ff;">kalAngleZ</span></td> <td align="center"><span style="color:#ff33ff;">kalAngleZ</span></td>
<td align="center"><span style="color:#4b8200;">gyroZrate</span></td> <td align="center"><span style="color:#4b8200;">gyroZrate</span></td>
</tr> </tr>
<tr> <tr>
<td align="center"><span style="color:#ff5c5c;" id="Shaft_Velocity"></span></td> <td align="center"><span style="color:#ff5c5c;" id="Shaft_Velocity"></span></td>
@ -306,9 +330,6 @@ function checkNum(obj) {
<td align="center"><span style="color:#ff33ff;" id="kalAngleZ"></span></td> <td align="center"><span style="color:#ff33ff;" id="kalAngleZ"></span></td>
<td align="center"><span style="color:#4b8200;" id="gyroZrate"></span></td> <td align="center"><span style="color:#4b8200;" id="gyroZrate"></span></td>
</tr> </tr>
</table>
</td>
</tr>
</table> </table>
</body> </body>
</html> </html>