fixed web-control path and watchdog stoping
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user