feat: simulator bridge, rig seed and web UI (in progress)

Work in progress from the same tree as the controller's sequences-v2 changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-11 14:10:55 +13:00
1 parent 4fc3345fc9
commit 4d8aeb5df8
26 files changed
+3907 -288

No files matched your search

+35 -8
View File
@@ -1,22 +1,49 @@
"""CPython stub for MicroPython `utime` (led-simulator)."""
"""CPython stub for MicroPython ``utime`` (led-simulator)."""
import time
import time as _time
_MS_MASK = (1 << 30) - 1
_MS_PERIOD = 1 << 30
_MS_MASK = _MS_PERIOD - 1
_HALF = _MS_PERIOD // 2
_T0 = _time.monotonic()
def sleep_ms(ms):
time.sleep(max(0, ms) / 1000.0)
_time.sleep(max(0, ms) / 1000.0)
def sleep_us(us):
_time.sleep(max(0, us) / 1000000.0)
def sleep(s):
time.sleep(s)
_time.sleep(s)
def ticks_ms():
return int(time.monotonic() * 1000) & _MS_MASK
return int((_time.monotonic() - _T0) * 1000) & _MS_MASK
def ticks_us():
return int((_time.monotonic() - _T0) * 1000000) & _MS_MASK
ticks_cpu = ticks_us
def ticks_add(ticks, delta):
return (int(ticks) + int(delta)) & _MS_MASK
def ticks_diff(t1, t0):
"""Approximate MicroPython ticks_diff for host monotonic ms."""
return ((t1 - t0 + (1 << 29)) & _MS_MASK) - (1 << 29)
"""Signed difference with wrap-around, like MicroPython."""
return ((int(t1) - int(t0) + _HALF) & _MS_MASK) - _HALF
def time():
"""Whole seconds, like MicroPython."""
return int(_time.time())
def time_ns():
return _time.time_ns()