Repository navigation
Conversation
Press b, confirm with Y, and the firmware runs its Z0 sensor cycle for the User (RML-1) coordinate system, based on a captured VPanel session (SET 0x3902 with the 0x2001 sensor pre-checks). The TUI keeps polling during the cycle, Esc requests a stop, and any cancelled/lost/timed-out cycle is reported as unverified. Extracted from the Z-probe parts of PR #3 by btingle (probing.py, tests, docs, decode entries and the TUI hooks); the jogging and move-to changes in that PR are left out. Co-authored-by: Chris Shucksmith <chris@shucksmith.co.uk> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Op 0x3900 / 0x3901 hold the Z0 sensor thickness, not the spindle RPM. To verify I parsed the Setup page's dialog template out of
What fills and saves it:
What this means for rollingmill:
Proposed changes
|
|
I've verified the first argument to op 3902 is the coordinate system slot number, so it was easy enough to extend this to work for the G54-G59 coordinates, which I verified in hardware. |
There was a problem hiding this comment.
🟡 Changes recommended
Failed stop commands are not retried after cancellation, allowing the probe to keep moving despite a stop request, while stale origin and thickness caches can misrepresent machine state.
3 open issues
What changed in this PR
Adds firmware-driven Z0 sensor probing to Rollingmill’s TUI, extracted from #3 without the jogging and move-to changes. It also adds sensor-thickness editing and corrects registers previously identified as spindle RPM settings.
Changes:
- Adds a probe dialog with target selection, thickness editing, polling, cancellation and command interlocks.
- Implements the probe cycle and corrects sensor-thickness handling in the machine API and trace decoder.
- Adds captured-status replay tests, failure-path coverage and protocol documentation; hardware validation remains pending.
| File | Description |
|---|---|
tests/test_z0_thickness.py |
Tests thickness reads, writes, validation and dialog controls. |
tests/test_probing.py |
Tests probe packets, cycle handling and TUI interlocks. |
tests/fixtures/mdx40a_zprobe_status.json |
Supplies captured probe status samples for replay. |
rollingmill/tui.py |
Adds probe controls, thickness editing and polling integration. |
rollingmill/probing.py |
Implements probe initiation, monitoring, cancellation and cleanup. |
rollingmill/machine.py |
Adds thickness accessors and corrects spindle-target initialization. |
rollingmill/decode.py |
Recognizes probe commands and decodes thickness values. |
README.md |
Documents the probe keybinding and feature availability. |
docs/z-probing.md |
Describes operation, protocol evidence and validation limits. |
docs/usb-protocol.md |
Corrects register descriptions and documents sensor commands. |
docs/machine-state.md |
Corrects the thickness-command acknowledgement description. |
Review effort: Balanced
a9ee59c to
e6959f6
Compare
Decoding VP_MDX40A.exe: the Setup dialog's "Thickness of Z0 Sensor:" edit box (dialog 4050, control 0x0FD9) is loaded from GET 0x3900 and saved with SET 0x3901, a big-endian uint32 in 1/1000 mm (default 15000, VPanel limits it to 14000-16000). Nothing else reads or writes them, so they were never a spindle RPM. - machine: get_spindle_rpm -> get_z0_sensor_thickness_mm, cached at connect as z0_sensor_thickness_mm; stop taking it as the target RPM, which now starts at SPINDLE_RPM_MIN; fix the spindle_on_rpm docstring (SET 0x3006) - decode: label the read/write as Z0_SENSOR_THICKNESS - docs: add a Z0 sensor section to usb-protocol.md, fix 0x3901 and 0x3a05 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
machine: set_z0_sensor_thickness_mm() writes SET 0x3901 (big-endian uint32, 1/1000 mm) inside the 0x1109 operation bracket, waits for the ping bit 21 ack like the Setup dialog's OK handler, then reads the value back; it is limited to VPanel's 14-16 mm and returns True only if the read-back matches. tui: the 'b' confirmation becomes a Z0 Sensor Probe dialog styled like the others (title, key summary at the bottom). It shows the stored thickness (no re-read), lets it be edited, H sets it, Enter starts the probe cycle (refused while an edited value is unset) and Esc cancels. Y no longer confirms. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
VPanel's MDx3902_GiantDispatch encodes the target coordinate system as the first word of SET 0x3902: 1 = User (RML-1), 2 = EXOFS, 3-8 = G54-G59, which is the WCS slot index rollingmill already uses (wcs_code in SET 0x3501, WCS_SLOT_NAMES, get_wcs_origin). Only slot 1 has a live capture. - probing: probe the active slot (1-8), send the slot as the first word and refresh that slot's origin afterwards; MCS and slots 9+ are rejected - tui: the dialog shows the target, refuses Enter for an unsupported target and warns when the command set is RML-1 (VPanel only offers G54-G59 and EXOFS in NC Code or automatic mode) - docs: record the encoder evidence in z-probing.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…arning Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Under `python -m rollingmill.tui`, getLogger(__name__) is "__main__", so the probe warnings showed with the wrong context and missed the rollingmill logger's level setting. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
da8f769 to
851e3d0
Compare
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The key summary uses the ↵ symbol and "Esc close" like the coordinates box, the three descriptive lines are grey instead of cyan, and there is a blank row before "Target". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>


Z0 sensor probing lifted out of #3 by @btingle so it can be tested and reviewed separately from the jogging / move-to changes. The commit keeps btingle as author.
What it does
bin the TUI, thenYto confirm, runs the firmware's Z0 sensor cycle for the User (RML-1) coordinate system;Escrequests a stop.rollingmill/probing.py(ZProbe) drives the cycle from a captured VPanel session: sensor pre-checks via 0x2001, then SET 0x3902. The TUI keeps polling; a cancelled, lost or timed-out cycle is reported as unverified rather than success.decode.pyknows the two new wValues;docs/z-probing.mdrecords the protocol evidence; README documents the key.What is deliberately not included
Everything else in #3: the pulse/hold jogging rework,
keyrelease.py, the move-to rewrite (move_activeetc.) and thesetuptools<81pin. The TUI changes here are only the probe hooks (key handling, polling, dialog, cleanup on exit).Test plan
pytest -q: newtests/test_probing.pyreplays the captured status samples and checks the exact USB bytes and TUI interlocksCredit: @btingle, #3.
🤖 Generated with Claude Code