Repository navigation
fix(machine): select the WCS through the driver - #636
Merged
Merged
Conversation
switch_active_wcs() sent the WCS name to the device with run_raw(), which only works where the name is a command (G54 to G59 on G-code controllers). The Ruida driver's WCS names (MACHINE, ANCHOR, CURRENT, SET_POINT) are not rpascript, so selecting "CURRENT" sent an unknown line, the adapter kept MACHINE, and the switch was reported as not confirmed. A reconnect then synced MACHINE back into the model. - switch_active_wcs() now calls driver.select_wcs(). The base implementation sends the name with run_raw(), so G-code drivers behave as before; the Ruida adapter records the selection. - A new Ruida adapter starts from the machine's active WCS when it is a Ruida reference point, so a rebuilt driver no longer reverts the selection to MACHINE. The controller does not store it.
medoix
force-pushed
the
fix/ruida-current-wcs
branch
from
October 26, 2026 03:17
552b458 to
950c995
Compare
medoix
marked this pull request as ready for review
October 26, 2026 03:22
Contributor
|
Thanks for the fix and the clear description - looks good! |
This branch was successfully deployed
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.
What does this PR change?
Selecting the "Current position" origin (Ruida WCS
CURRENT) never reached the Ruida driver.MachineController.switch_active_wcs()sent the WCS name to the device withrun_raw(). That works where the name is a command (G54toG59on G-code controllers), but the Ruida names (MACHINE,ANCHOR,CURRENT,SET_POINT) are not rpascript. The adapter keptMACHINE, so the switch was logged asDevice did not confirm WCS switch to CURRENT, got MACHINE.sync_active_wcs_from_device()readMACHINEback from the adapter and reset the machine's selection, so jobs could silently run from the machine origin instead.Changes:
switch_active_wcs()callsdriver.select_wcs()instead ofrun_raw().Driver.select_wcs()now sends the name withrun_raw(), so GRBL and other G-code drivers send exactly what they sent before.MACHINE. A Ruida controller does not store this selection, so the machine model is its only record.Why did you choose this specific architectural approach?
Driver.select_wcs()already exists as the driver hook for choosing a WCS, and the Ruida adapter already implements it, but the UI path went around it. Routingswitch_active_wcs()throughselect_wcs()lets each driver decide what selecting a WCS means, and giving the base method the oldrun_raw()behaviour keeps the G-code drivers unchanged without touching them.Alternatives considered:
run_raw()recognise WCS names. That mixes WCS selection into the raw rpascript path, andread_parser_state()would still be reset on reconnect.MachineController.select_wcs()also callsdriver.select_wcs(); it has no callers today, so the new base behaviour does not change any existing path.Known limitation, not addressed here: the Ruida
frame()sends absolute moves, so framing still ignores the selected origin. That needs its own change.How did you manually test this locally?
RDLC-V26.60.20 controller over UDP and an RDC8445S over TCP.
REF_POINT_CURRENT(D8 12) and the controller cuts at the head position instead of returning to the machine origin.Tests: new tests check that
switch_active_wcs()goes throughselect_wcs()withoutrun_raw(), that the baseselect_wcs()sends the name withrun_raw(), and that a new Ruida adapter reports the machine's WCS (falling back toMACHINEforG54). The machine and Ruida driver test folders pass apart fromtest_end_failed_carries_messageandtest_failed_job_reports_error_message, which fail the same way on unmodified main in my environment.Checklist
this code.