Handle cold-boot timeout for TCP connections

- bridges/tcp_serial_bridge.py: increase default boot_delay 2s → 8s to
  cover MiniMate Plus cold-start time (unit wakes from RS-232 line
  assertion but takes 5-10s to be ready for POLL_PROBE).
- sfm/server.py: add _run_with_retry() — on TCP connections only, retries
  once on ProtocolError. Serial timeouts are not retried (usually a real
  fault). Confirmed behaviour: unit wakes purely from RS-232 line voltage,
  no software wake-up frame needed.
This commit is contained in:
Brian Harrison
2026-03-31 12:02:52 -04:00
parent da446cb2e3
commit de02f9cccf
2 changed files with 42 additions and 10 deletions

View File

@@ -55,8 +55,10 @@ DEFAULT_TCP_PORT = 12345
CHUNK = 256 # bytes per read call
SERIAL_TIMEOUT = 0.02 # serial read timeout (s) — non-blocking in practice
TCP_TIMEOUT = 0.02 # socket recv timeout (s)
BOOT_DELAY = 2.0 # seconds to wait after opening serial port before
# forwarding data — mirrors the unit's startup beep
BOOT_DELAY = 8.0 # seconds to wait after opening serial port before
# forwarding data — unit cold-boot (beep + OS init)
# takes 5-10s from first RS-232 line assertion.
# Set to 0 if unit was already running before connect.
# ── Bridge session ─────────────────────────────────────────────────────────────