From ec55c24a7cf489107883803edeb053a71e214ac4 Mon Sep 17 00:00:00 2001 From: Mee2001 Date: Tue, 15 Jun 2021 09:42:22 +0100 Subject: [PATCH] Implement stop Fix UI --- Control/data/index.html | 14 +++++++++++--- Drive/src/main.cpp | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Control/data/index.html b/Control/data/index.html index 12f4278..21c0fff 100644 --- a/Control/data/index.html +++ b/Control/data/index.html @@ -130,9 +130,9 @@ - - - + + +
@@ -275,6 +275,8 @@ rStatus = "Moving"; }else if(state == 2){ rStatus = "Charging"; + }else if(state == 3){ + rStatus = "Waiting"; }else{ rStatus = "Undefined"; } @@ -306,6 +308,12 @@ bufferOutput = document.getElementById("commandInput").value; }else if(cmdMode == 1){ 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)){ document.getElementById("command_buffer").innerHTML += '[' + command_id + '] ' + bufferOutput + "
"; diff --git a/Drive/src/main.cpp b/Drive/src/main.cpp index a2d525d..e346166 100644 --- a/Drive/src/main.cpp +++ b/Drive/src/main.cpp @@ -456,6 +456,10 @@ void loop() }else if (rdoc.containsKey("cH")){ currentHeading = 180 + int(rdoc["cH"]); // Serial.println(currentHeading); + }else if (rdoc.containsKey("stp") && rdoc["stp"] == 1){ + digitalWrite(pwmr, LOW); + digitalWrite(pwml, LOW); + commandCompletionStatus = 3; } } }