fix bugs
This commit is contained in:
parent
84ae8fdbdc
commit
8a106c3717
@ -145,7 +145,7 @@ async def newClient(clientId, ws):
|
|||||||
|
|
||||||
async def newBoat(boatId, name, ws):
|
async def newBoat(boatId, name, ws):
|
||||||
boat = { "id": boatId, "name": name, "ws": ws, "state": "active" }
|
boat = { "id": boatId, "name": name, "ws": ws, "state": "active" }
|
||||||
print("new client connected: " + client['id'])
|
print("new client connected: " + boatId)
|
||||||
for bo in boats:
|
for bo in boats:
|
||||||
if (bo['id'] == boat['id']):
|
if (bo['id'] == boat['id']):
|
||||||
bo['state'] = 'terminated'
|
bo['state'] = 'terminated'
|
||||||
|
|||||||
@ -41,6 +41,8 @@
|
|||||||
{
|
{
|
||||||
console.log('WebSocket Error ', error);
|
console.log('WebSocket Error ', error);
|
||||||
alert('WebSocket Error ', error);
|
alert('WebSocket Error ', error);
|
||||||
|
|
||||||
|
//connection.onmessage({ data: "boats:50;test 1;available:164;tosti;available" })
|
||||||
};
|
};
|
||||||
|
|
||||||
connection.onmessage = function (e)
|
connection.onmessage = function (e)
|
||||||
@ -59,6 +61,13 @@
|
|||||||
{
|
{
|
||||||
console.log("render boat", boat);
|
console.log("render boat", boat);
|
||||||
let el = document.createElement("div");
|
let el = document.createElement("div");
|
||||||
|
el.style.textAlign = "center";
|
||||||
|
el.style.borderRadius = "10px";
|
||||||
|
el.style.backgroundColor = "#242495";
|
||||||
|
el.style.padding = "10px";
|
||||||
|
el.style.margin = "5px 25%";
|
||||||
|
el.style.color = "white";
|
||||||
|
el.style.cursor = "pointer";
|
||||||
el.id = "boat" + boat[0];
|
el.id = "boat" + boat[0];
|
||||||
el.innerHTML = boat[1];
|
el.innerHTML = boat[1];
|
||||||
el.addEventListener('click', selectBoat);
|
el.addEventListener('click', selectBoat);
|
||||||
|
|||||||
@ -29,7 +29,7 @@ static uint8_t BoatId = 1;
|
|||||||
#define SERVOS_CH6
|
#define SERVOS_CH6
|
||||||
|
|
||||||
#define WS_RX_BUFFER_LEN 512
|
#define WS_RX_BUFFER_LEN 512
|
||||||
#define WS_URL "ws://10.254.0.2:8080/"
|
#define WS_URL "ws://10.254.0.1:8080/"
|
||||||
|
|
||||||
#define LOGGER_BUFFER_SIZE 65536
|
#define LOGGER_BUFFER_SIZE 65536
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user