Skip to content

Commit

Permalink
fix serial resending for motor on and off
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-8 committed Jun 19, 2024
1 parent 2a233c1 commit 43b5430
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,6 @@ async function sendStringSerial(string, verifyData) {
name = "DRIVE_BUTTON_"; // change name to match the setting property of the car's result message
name += string.split(":")[1].split("_")[0]; // add the button number
}
if (name == "S") {
name = "stopped";
}
if (name == "G") {
name == "movement allowed";
}
verify[name] = setTimeout(() => {
console.log("serial resend triggered: ", string);
try {
Expand Down Expand Up @@ -1237,6 +1231,14 @@ function gotNewResult(result) {
document.getElementById('setting---' + result["setting"]).children[1].firstChild.value = result["value"]; // change input to what the Arduino says it received
}
}
if (result["result"] === "movement allowed") {
clearTimeout(verify["G,"]);
delete verify["G,"];
}
if (result["result"] === "stopped") {
clearTimeout(verify["S,"]);
delete verify["S,"];
}
if (result["result"] === "saved") { // saved settings to EEPROM
var elements = document.getElementsByClassName("car-setting-row");
for (var i = 0; i < elements.length; i++) {
Expand Down

0 comments on commit 43b5430

Please sign in to comment.