Repository navigation
v1 Mantis: the sequencer, and events read by their content - #1622
Merged
Merged
Conversation
BioCam
force-pushed
the
mantis-v1-02-sequencer-events
branch
from
November 12, 2026 19:00
fea73e8 to
7a6f95a
Compare
BioCam
force-pushed
the
mantis-v1-02-sequencer-events
branch
from
November 12, 2026 21:05
7a6f95a to
d275e0c
Compare
BioCam
marked this pull request as ready for review
November 12, 2026 21:18
Events are decoded in a pure module (motion started, move done, home done, motor error, sequence progress, sequencer stopped, input changed) and logged by what they carry; a code not decoded is logged by its number. A waiter matches on the payload, and a motor-error event fails every motion waiter at once. The sequencer's clear, start, stop and abort are raw calls sent once. A queued PPI write numbers its item from 1 to 0x7FFF and is sent once; a reply of -1 free slots is sent again under the next item until queued, for at most default_queue_full_timeout. A queue write is never resent: a v4 queued a frame written twice under one packet number as two items. A wait for a queue item does not miss a report that came with the reply. The simulated driver holds a 200-item queue that plays at once when started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BioCam
force-pushed
the
mantis-v1-02-sequencer-events
branch
from
November 13, 2026 08:03
d275e0c to
16b39af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem
Every motion on the Mantis runs through its sequencer: a queue on the motion board that plays valve states and moves in order, each held for a set time. The device also reports, unasked, when a motor starts, finishes, homes or faults, and when a queued item plays. Without a sequencer and without reading those reports, nothing can move safely: a wait cannot know its move finished, and a motor fault goes unnoticed.
PR Content/Solution
driver/events.py): every report the device sends unasked is decoded by its content (motion started, move done, home done, motor error, sequence progress, sequencer stopped, input changed) and logged in words; an unknown one is logged by its number. A motor-error report fails every waiting motion at once._queue_ppi_write), each sent once. A full queue (200 items) answers -1; the write is sent again under the next item number until it is queued, for at mostdefault_queue_full_timeout(60 s), so no item can play twice. A wait for an item does not miss a report that arrived with the reply.This is the base the arm and pump PRs queue through; it has no user-facing call of its own beyond
default_queue_full_timeout.On the device
A Mantis v4 on Windows (D2XX); only the chip valves switched, the pump stayed off:
🤖 Generated with Claude Code