mirror of
https://github.com/supleed2/ELEC50003-P1-CW.git
synced 2024-11-10 01:35:50 +00:00
Implement stop
Fix UI
This commit is contained in:
parent
1961951de0
commit
ec55c24a7c
|
@ -130,9 +130,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center;" colspan="2"><button style="color: red;">Emergency<br>Stop</button></td>
|
<td style="text-align: center;" colspan="2"><button onclick="setCmdMode(0); stpCmd();" style="color: red;">Emergency<br>Stop</button></td>
|
||||||
<td style="text-align: center;" colspan="2"><button>Telemetry<br>Reset</button></td>
|
<td style="text-align: center;" colspan="2"><button onclick="setCmdMode(-1); telRst();">Telemetry<br>Reset</button></td>
|
||||||
<td style="text-align: center;" colspan="2"><button>Full<br>Charge</button></td>
|
<td style="text-align: center;" colspan="2"><button onclick="setCmdMode(2); chrgCmd(100);">Full<br>Charge</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="6"><hr></td></tr>
|
<tr><td colspan="6"><hr></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -275,6 +275,8 @@
|
||||||
rStatus = "Moving";
|
rStatus = "Moving";
|
||||||
}else if(state == 2){
|
}else if(state == 2){
|
||||||
rStatus = "Charging";
|
rStatus = "Charging";
|
||||||
|
}else if(state == 3){
|
||||||
|
rStatus = "Waiting";
|
||||||
}else{
|
}else{
|
||||||
rStatus = "Undefined";
|
rStatus = "Undefined";
|
||||||
}
|
}
|
||||||
|
@ -306,6 +308,12 @@
|
||||||
bufferOutput = document.getElementById("commandInput").value;
|
bufferOutput = document.getElementById("commandInput").value;
|
||||||
}else if(cmdMode == 1){
|
}else if(cmdMode == 1){
|
||||||
bufferOutput = "move " + reqDistance + "mm " + reqHeading + "deg " + reqSpeed + "%";
|
bufferOutput = "move " + reqDistance + "mm " + reqHeading + "deg " + reqSpeed + "%";
|
||||||
|
}else if(cmdMode == 2){
|
||||||
|
bufferOutput = "charge " + reqCharge + "%";
|
||||||
|
}else if(cmdMode == 3){
|
||||||
|
bufferOutput = "wait " + pstop_time + "s";
|
||||||
|
}else if(cmdMode == -1){
|
||||||
|
bufferOutput = "telemetry reset";
|
||||||
}
|
}
|
||||||
if((mode == 1) || (mode == -1) || (mode == 2) || (mode == 3)){
|
if((mode == 1) || (mode == -1) || (mode == 2) || (mode == 3)){
|
||||||
document.getElementById("command_buffer").innerHTML += '[' + command_id + '] ' + bufferOutput + "<br>";
|
document.getElementById("command_buffer").innerHTML += '[' + command_id + '] ' + bufferOutput + "<br>";
|
||||||
|
|
|
@ -456,6 +456,10 @@ void loop()
|
||||||
}else if (rdoc.containsKey("cH")){
|
}else if (rdoc.containsKey("cH")){
|
||||||
currentHeading = 180 + int(rdoc["cH"]);
|
currentHeading = 180 + int(rdoc["cH"]);
|
||||||
// Serial.println(currentHeading);
|
// Serial.println(currentHeading);
|
||||||
|
}else if (rdoc.containsKey("stp") && rdoc["stp"] == 1){
|
||||||
|
digitalWrite(pwmr, LOW);
|
||||||
|
digitalWrite(pwml, LOW);
|
||||||
|
commandCompletionStatus = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue