|
@@ -157,7 +157,7 @@ serial:
|
|
|
io_timeout_ms: 28000
|
|
io_timeout_ms: 28000
|
|
|
inter_byte_timeout_ms: 2000
|
|
inter_byte_timeout_ms: 2000
|
|
|
response_timeout_ms: 28000
|
|
response_timeout_ms: 28000
|
|
|
- get_temp_timeout_ms: 20000
|
|
|
|
|
|
|
+ get_temp_timeout_ms: 28000
|
|
|
get_motor_timeout_ms: 28000
|
|
get_motor_timeout_ms: 28000
|
|
|
probe_timeout_ms: 28000
|
|
probe_timeout_ms: 28000
|
|
|
set_all_timeout_ms: 2000
|
|
set_all_timeout_ms: 2000
|
|
@@ -243,12 +243,21 @@ def _clear_startup_complete(frame: bytes) -> bytes:
|
|
|
|
|
|
|
|
|
|
|
|
|
class UartTap:
|
|
class UartTap:
|
|
|
- """Hold MOTOR_STATUS startup_complete=0 for wall-clock delayed-startup tests."""
|
|
|
|
|
|
|
+ """Hold MOTOR_STATUS startup_complete=0 for wall-clock delayed-startup tests.
|
|
|
|
|
|
|
|
- def __init__(self, hold_s: float = 10.0) -> None:
|
|
|
|
|
|
|
+ Production UART (217 clocks/bit through Icarus) needs ~13s for the first
|
|
|
|
|
+ MOTOR_STATUS round-trip. A 10s hold expires first, leaks startup_complete,
|
|
|
|
|
+ and hthd immediately sends GET_TEMPERATURE which then times out.
|
|
|
|
|
+ Keep holding until hold_s elapses AND at least one MOTOR_STATUS has been
|
|
|
|
|
+ rewritten, capped at max_hold_s.
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(self, hold_s: float = 10.0, max_hold_s: float | None = None) -> None:
|
|
|
self.hold_s = hold_s
|
|
self.hold_s = hold_s
|
|
|
|
|
+ self.max_hold_s = hold_s if max_hold_s is None else max_hold_s
|
|
|
self._start = 0.0
|
|
self._start = 0.0
|
|
|
self._started = threading.Event()
|
|
self._started = threading.Event()
|
|
|
|
|
+ self._cleared_motors = 0
|
|
|
self.up_buf = bytearray()
|
|
self.up_buf = bytearray()
|
|
|
self.dn_buf = bytearray()
|
|
self.dn_buf = bytearray()
|
|
|
self.get_temp_during_hold = 0
|
|
self.get_temp_during_hold = 0
|
|
@@ -264,7 +273,12 @@ class UartTap:
|
|
|
def holding(self) -> bool:
|
|
def holding(self) -> bool:
|
|
|
if not self._started.is_set():
|
|
if not self._started.is_set():
|
|
|
return False
|
|
return False
|
|
|
- return time.monotonic() < self._start + self.hold_s
|
|
|
|
|
|
|
+ elapsed = time.monotonic() - self._start
|
|
|
|
|
+ if elapsed >= self.max_hold_s:
|
|
|
|
|
+ return False
|
|
|
|
|
+ if elapsed < self.hold_s:
|
|
|
|
|
+ return True
|
|
|
|
|
+ return self._cleared_motors == 0
|
|
|
|
|
|
|
|
def on_pty_to_rtl(self, data: bytes) -> None:
|
|
def on_pty_to_rtl(self, data: bytes) -> None:
|
|
|
self.up_buf.extend(data)
|
|
self.up_buf.extend(data)
|
|
@@ -295,6 +309,7 @@ class UartTap:
|
|
|
for frame in frames:
|
|
for frame in frames:
|
|
|
if hold and len(frame) >= 3 and frame[2] == 0x83:
|
|
if hold and len(frame) >= 3 and frame[2] == 0x83:
|
|
|
frame = _clear_startup_complete(frame)
|
|
frame = _clear_startup_complete(frame)
|
|
|
|
|
+ self._cleared_motors += 1
|
|
|
out.extend(frame)
|
|
out.extend(frame)
|
|
|
return bytes(out)
|
|
return bytes(out)
|
|
|
|
|
|
|
@@ -384,7 +399,7 @@ async def main():
|
|
|
else:
|
|
else:
|
|
|
raise SystemExit("hthd never reached READY against RTL")
|
|
raise SystemExit("hthd never reached READY against RTL")
|
|
|
caps = await client.get_capabilities("prod2u-0")
|
|
caps = await client.get_capabilities("prod2u-0")
|
|
|
- async with await client.acquire_lease("prod2u-0", "rtl-l3", timedelta(seconds=30), auto_renew=False) as lease:
|
|
|
|
|
|
|
+ async with await client.acquire_lease("prod2u-0", "rtl-l3", timedelta(seconds=30), auto_renew=True) as lease:
|
|
|
snap = await client.get_snapshot("prod2u-0")
|
|
snap = await client.get_snapshot("prod2u-0")
|
|
|
b = ActionBatch.builder("prod2u-0", capabilities=caps).based_on(snap.snapshot_seq, snap.control_revision)
|
|
b = ActionBatch.builder("prod2u-0", capabilities=caps).based_on(snap.snapshot_seq, snap.control_revision)
|
|
|
b.valid_for(timedelta(seconds=180))
|
|
b.valid_for(timedelta(seconds=180))
|
|
@@ -431,7 +446,7 @@ async def main():
|
|
|
raise SystemExit(f"expected 27 temperature channels after GET_TEMP, got {len(temps)}")
|
|
raise SystemExit(f"expected 27 temperature channels after GET_TEMP, got {len(temps)}")
|
|
|
print("TEMP_CHANNELS", len(temps), "EVENT_ID", snap.event_id, "QUALITY", sorted({m.quality for m in temps}))
|
|
print("TEMP_CHANNELS", len(temps), "EVENT_ID", snap.event_id, "QUALITY", sorted({m.quality for m in temps}))
|
|
|
caps = await client.get_capabilities("prod2u-0")
|
|
caps = await client.get_capabilities("prod2u-0")
|
|
|
- async with await client.acquire_lease("prod2u-0", "rtl-safe", timedelta(seconds=30), auto_renew=False) as lease:
|
|
|
|
|
|
|
+ async with await client.acquire_lease("prod2u-0", "rtl-safe", timedelta(seconds=30), auto_renew=True) as lease:
|
|
|
safe = await lease.enter_safe_mode("rtl-safe")
|
|
safe = await lease.enter_safe_mode("rtl-safe")
|
|
|
print("SAFE_ACCEPTED", safe.accepted, safe.dispatch_state, safe.confirmation)
|
|
print("SAFE_ACCEPTED", safe.accepted, safe.dispatch_state, safe.confirmation)
|
|
|
snap = await client.get_snapshot("prod2u-0")
|
|
snap = await client.get_snapshot("prod2u-0")
|
|
@@ -626,7 +641,12 @@ def main() -> int:
|
|
|
return 1
|
|
return 1
|
|
|
|
|
|
|
|
stop = threading.Event()
|
|
stop = threading.Event()
|
|
|
- tap = UartTap(hold_s=10.0)
|
|
|
|
|
|
|
+ if clks == "217":
|
|
|
|
|
+ tap = UartTap(hold_s=45.0, max_hold_s=90.0)
|
|
|
|
|
+ else:
|
|
|
|
|
+ tap = UartTap(hold_s=10.0, max_hold_s=20.0)
|
|
|
|
|
+ print(f"DELAYED_STARTUP_HOLD_S={tap.hold_s} MAX={tap.max_hold_s}", flush=True)
|
|
|
|
|
+
|
|
|
threading.Thread(target=_shuttle, args=(master, conn, stop, tap), daemon=True).start()
|
|
threading.Thread(target=_shuttle, args=(master, conn, stop, tap), daemon=True).start()
|
|
|
|
|
|
|
|
for _ in range(900):
|
|
for _ in range(900):
|
|
@@ -654,8 +674,9 @@ def main() -> int:
|
|
|
# Start hthd only after RTL calibration. Overlapping host UART with
|
|
# Start hthd only after RTL calibration. Overlapping host UART with
|
|
|
# Icarus bit-banging 5000-step seek makes MOTOR_STATUS miss the 28s
|
|
# Icarus bit-banging 5000-step seek makes MOTOR_STATUS miss the 28s
|
|
|
# timeout and look like a reconnect loop. After hthd starts, the UART
|
|
# timeout and look like a reconnect loop. After hthd starts, the UART
|
|
|
- # tap holds MOTOR_STATUS.startup_complete=0 for 10s wall-clock so the
|
|
|
|
|
- # production UART path proves no GET_TEMPERATURE during delayed startup.
|
|
|
|
|
|
|
+ # tap holds MOTOR_STATUS.startup_complete=0 until hold_s (45s on 217
|
|
|
|
|
+ # baud) and at least one MOTOR_STATUS rewrite, so production UART
|
|
|
|
|
+ # proves no GET_TEMPERATURE during delayed startup.
|
|
|
tap.mark_hthd_start()
|
|
tap.mark_hthd_start()
|
|
|
hthd = subprocess.Popen([str(hthd_bin), "--config", str(cfg)], cwd=str(HOST), env={**os.environ})
|
|
hthd = subprocess.Popen([str(hthd_bin), "--config", str(cfg)], cwd=str(HOST), env={**os.environ})
|
|
|
for _ in range(200):
|
|
for _ in range(200):
|