added static Access Point and Captive Portal and some small adjustments
This commit is contained in:
@@ -5,6 +5,28 @@ import serial
|
||||
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
import time
|
||||
import logging
|
||||
|
||||
log = logging.getLogger("drive")
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
_last_send_t = None
|
||||
|
||||
def log_send_timing(note: str = ""):
|
||||
global _last_send_t
|
||||
now = time.perf_counter() # monotonic + hochauflösend
|
||||
if _last_send_t is None:
|
||||
_last_send_t = now
|
||||
return
|
||||
dt_ms = (now - _last_send_t) * 1000.0
|
||||
_last_send_t = now
|
||||
|
||||
# Nur loggen wenn "auffällig"
|
||||
if dt_ms > 120:
|
||||
log.warning("SERIAL SEND GAP %.0f ms %s", dt_ms, note)
|
||||
|
||||
|
||||
SERIAL_PORT = "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0" # ggf. /dev/ttyUSB0
|
||||
BAUD = 115200
|
||||
|
||||
@@ -24,6 +46,7 @@ def send_lr(l: int, r: int):
|
||||
l = clamp255(l)
|
||||
r = clamp255(r)
|
||||
line = f"L {l} R {r}\n".encode("ascii")
|
||||
log_send_timing("(before write)")
|
||||
ser.write(line)
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user