fixed web-control path and watchdog stoping

This commit is contained in:
Helva
2026-02-08 14:04:31 +01:00
parent f75c654a39
commit 4b040391da
2 changed files with 21 additions and 3 deletions
+5 -2
View File
@@ -9,7 +9,7 @@ SERIAL_PORT = "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0" # ggf. /de
BAUD = 115200
# Safety: if websocket stops sending, we also stop.
STOP_AFTER_SEC = 0.35
STOP_AFTER_SEC = 0.5
app = FastAPI()
@@ -30,11 +30,14 @@ def send_lr(l: int, r: int):
def health():
return {"ok": True, "serial": SERIAL_PORT}
@app.websocket("/drive-ws")
@app.websocket("/ws")
async def ws(websocket: WebSocket):
global last_msg_ts
await websocket.accept()
last_msg_ts = time.time()
send_lr(0, 0)
async def watchdog():
while True:
await asyncio.sleep(0.05)