try
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
var ws;
|
||||
var checked_for_connection = false;
|
||||
var connected_to_api = false;
|
||||
setInterval(check_ws_connection, 1000, ws);
|
||||
// setInterval(check_ws_connection, 1000, ws);
|
||||
assign_button_callbacks();
|
||||
openSocket = () => {
|
||||
|
||||
@@ -318,14 +318,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function check_ws_connection(ws) {
|
||||
function check_ws_connection() {
|
||||
if (checked_for_connection == false && connected_to_api)
|
||||
{
|
||||
console.log("Checking connection to API")
|
||||
if (ws.readyState != WebSocket.OPEN) {
|
||||
alert("Lost connection to API!")
|
||||
document.getElementById("connectedlabel").innerHTML = "Not connected to drone";
|
||||
document.getElementById("connectbutton").disabled = false;
|
||||
document.getElementById("connectbutton").disabled = false;
|
||||
checked_for_connection = true;
|
||||
}
|
||||
}
|
||||
@@ -340,6 +340,7 @@
|
||||
document.getElementById("connectedlabel").innerHTML = "Connected to drone";
|
||||
document.getElementById("connectbutton").disabled = true;
|
||||
connected_to_api = true;
|
||||
setInterval(check_ws_connection, 1000);
|
||||
openSocket();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user