added static Access Point and Captive Portal and some small adjustments
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# --- Captive Portal Trigger (Android/iOS/Windows) ---
|
||||
# Android / Google connectivity check
|
||||
location = /generate_204 { return 302 /; }
|
||||
location = /gen_204 { return 302 /; }
|
||||
|
||||
# iOS/macOS captive check
|
||||
location = /hotspot-detect.html { return 200 '<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>OK</BODY></HTML>'; add_header Content-Type text/html; }
|
||||
location = /library/test/success.html { return 302 /; }
|
||||
|
||||
# Windows NCSI check
|
||||
location = /ncsi.txt { return 302 /; }
|
||||
location = /connecttest.txt { return 302 /; }
|
||||
|
||||
# Optional: Android “portal” URL
|
||||
location = /captiveportal { return 302 /; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
location ^~ /drive/ {
|
||||
alias /opt/helva-robot/drive/var/www/drive/;
|
||||
location ^~ /drive {
|
||||
alias /opt/helva-robot/drive/var/www/drive;
|
||||
try_files $uri $uri/ /drive/index.html;
|
||||
}
|
||||
|
||||
|
||||
@@ -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