From 463843bf8bb0ac1cc3c317c5cf7aac3b52addc64 Mon Sep 17 00:00:00 2001 From: FReenen Date: Thu, 8 Aug 2024 20:55:40 +0200 Subject: [PATCH] fix bugs ?? tromgeroffel --- ground-station.py | 8 +++----- index.html | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ground-station.py b/ground-station.py index d22084a..a4cefae 100644 --- a/ground-station.py +++ b/ground-station.py @@ -59,23 +59,20 @@ async def echoClients(client): async def takeControll(client, boat): global boats - print("DEBUG: " + client['id'] + " takes controll of " + boat) if (client['boat'] is not None): client['boat']["state"] = BOAT_STATE_AVAILABLE client["boat"] = None for b in boats: if (b['id'] == boat): - print("DEBUG: boat found") if (b['state'] == BOAT_STATE_AVAILABLE): b["state"] = BOAT_STATE_INCTRL print("take controll: " + str(client["id"]) + " -> " + b["name"]) client["boat"] = b + client['ws'].send("OK") return else: - print("WARN: takeControll: " + b["name"] + " not available (" + str(client["id"]) + ")") break - else: - print("DEBUG: " + boat + " != " + b['id']) + client['ws'].send("FAIL") async def freeBoat(boat): global boats, clients @@ -131,6 +128,7 @@ async def onMessage(message, client): print("WARN: controll cmd (" + client['id'] + ") to None: " + data[2]) else: print("INFO: controll cmd (" + client['id'] + ") to " + client['boat']['name'] + ": " + data[2]) + client['boat']['ws'].send("d:" + data[2]) else: print("WARN: invalid command (" + client['id'] + "): '" + data[1] + "'") diff --git a/index.html b/index.html index 6764c62..39a6d64 100644 --- a/index.html +++ b/index.html @@ -90,6 +90,8 @@ } function send(x,y,angle){ + x = Math.round((x + 100) * 163.84); + y = Math.round((y + 100) * 163.84); var data = clientId + ";d;" + x.toString() + "," + y.toString(); connection.send(data); }