This commit is contained in:
david rice
2026-04-21 12:26:10 +01:00
parent 9f1536a157
commit ca0faf79d8
5 changed files with 255 additions and 12 deletions

View File

@@ -27,7 +27,6 @@ import sys
import requests
from datetime import datetime
from pathlib import Path
import math
import os
import struct
@@ -51,6 +50,7 @@ load_dotenv(Path(__file__).parent / ".env")
DEVICE_BASE = "http://192.168.45.8:5000"
URL = f"{DEVICE_BASE}/display"
VIDEO_URL = f"{DEVICE_BASE}/video"
SCOPE_IP = "192.168.45.4"
PSU_IP = "192.168.45.3"
@@ -841,6 +841,22 @@ def _append_flicker_log(ts: str, iteration: int, m: LPMetrics) -> None:
])
def _start_video() -> None:
try:
requests.put(VIDEO_URL, json={"action": "start"}, timeout=3)
print(" VIDEO: kiosk player started.")
except Exception as e:
print(f" WARNING: video start failed: {e}")
def _stop_video() -> None:
try:
requests.put(VIDEO_URL, json={"action": "stop"}, timeout=3)
print(" VIDEO: kiosk player stopped.")
except Exception as e:
print(f" WARNING: video stop failed: {e}")
def _play_alarm() -> None:
"""Play three short beeps using a generated WAV tone."""
sample_rate = 44100
@@ -1356,6 +1372,8 @@ def run_interactive_test() -> None:
print("The display stays ON while Claude and the operator assess the frame.")
print("Press Ctrl+C at any time to stop.\n")
_start_video()
try:
while True:
# ── Display ON ─────────────────────────────────────────────────
@@ -1423,7 +1441,7 @@ def run_interactive_test() -> None:
print("\n FLICKER CONFIRMED BY OPERATOR. STOPPING TEST.")
stop_reason = (f"Flicker confirmed by operator at "
f"capture {iteration:04d} [{ts}]")
# Display OFF
_stop_video()
try:
requests.put(URL, json={"state": "off"}, timeout=2)
except Exception:
@@ -1450,6 +1468,7 @@ def run_interactive_test() -> None:
except KeyboardInterrupt:
print("\n\n TEST INTERRUPTED (Ctrl+C).")
stop_reason = "Test interrupted by operator (Ctrl+C)"
_stop_video()
try:
requests.put(URL, json={"state": "off"}, timeout=2)
except Exception: