Helios panel: refresh about every 0.65 s, and yield the port to the operator
Three things were making the panel feel slow, all of them waiting rather than working. The trailing quiet window is waited out once per query, so it set the pace of the whole sweep: at 50 ms that was 400 ms of a 590 ms poll spent listening to silence. A reply streams at the baud rate — ~1 ms between bytes, no measurable gap between its lines — and the deadline restarts on every line read, so 20 ms outlasts the gap it exists for twenty times over. A tail that still arrives late is caught by _discard_input(), which is what actually protects the next query. Replayed against the rig transcript, a sweep goes from 590 ms to 356 ms. The poll interval was 1 s on top of that, so a value could be 1.6 s stale. At 0.3 s the panel comes round about every 0.65 s. And a poll held the port for its whole sweep, so a button pressed during one waited for all eight queries. _work_pending() on the worker base lets a poll drop what is left as soon as the operator queues something: a click now waits ~135 ms for the register read in progress instead of the full sweep, and the rest is picked up next time round. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -107,7 +107,15 @@ class HeliosLaser:
|
||||
# as a "Bit 15..0" string, and the reads around it timing out on a
|
||||
# leading blank line. So: match a reply to the command that asked for
|
||||
# it, and read off the rest of it before the next command goes out.
|
||||
TRAILING_QUIET_S = 0.05 # the line counts as idle after this long
|
||||
# How long the line has to stay silent before a reply counts as over.
|
||||
# It is waited out once per query, so it sets the pace of the whole
|
||||
# status poll: at 50 ms that was 400 ms of a 590 ms poll spent listening
|
||||
# to nothing. A reply streams at the baud rate — ~1 ms between bytes,
|
||||
# no measurable gap between its lines — and the deadline restarts on
|
||||
# every line, so 20 ms is twenty times the gap it has to outlast. A
|
||||
# tail that still arrives late is caught by _discard_input() rather
|
||||
# than by waiting longer here.
|
||||
TRAILING_QUIET_S = 0.02
|
||||
MAX_REPLY_LINES = 8
|
||||
|
||||
def _discard_input(self):
|
||||
@@ -269,7 +277,7 @@ class HeliosLaser:
|
||||
# it worked, and the panel's next status poll reads back the old value —
|
||||
# which looks exactly like the GUI refusing the operator's number.
|
||||
SET_RETRIES = 3
|
||||
SET_SETTLE_S = 0.05 # let the controller store it before reading
|
||||
SET_SETTLE_S = 0.02 # let the controller store it before reading
|
||||
|
||||
def _write_verified(self, mnemonic: str, value: int) -> bool:
|
||||
"""Write `value` to `mnemonic`, and confirm the controller took it.
|
||||
|
||||
Reference in New Issue
Block a user