aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/script.js b/script.js
index 3763ec8..85b5d61 100644
--- a/script.js
+++ b/script.js
@@ -189,8 +189,10 @@ document.getElementById("btn_connect").onclick = async () => {
document.querySelector(".info-device").classList.remove("connected");
document.querySelector(".connection-status").innerHTML = "DISCONNECTED";
clearInterval(connCheckInterval);
+ device.gatt.disconnect();
}
} else {
+ clearInterval(connCheckInterval);
alert("FATAL ERROR, Please reload page...");
clearInterval(connCheckInterval);
}
@@ -232,12 +234,11 @@ document.getElementById("btn_connect").onclick = async () => {
"T" + hoverControl.getThrottle() +
"R" + hoverControl.getRudder() +
"A" + (hoverControl.getArm() ? "1" : "0") +
- "S0" + // Sending this one because my decoding-code is a bit buggy currently.
":";
- console.log(command);
await services.uartService.sendText(command);
} else {
- clearInterval(sendCommands)
+ clearInterval(sendCommands);
+ device.gatt.disconnect();
}
}
}, 50);