Repository navigation
task: undo read-ahead modes when an error aborts a program (#4715) - #4727
Open
grandixximo wants to merge 1 commit into
Open
grandixximo wants to merge 1 commit into
grandixximo wants to merge 1 commit into
Conversation
…4715) When motion rejects a move (a soft limit, for one) or motion or io report an error, task aborts the program. The interpreter has by then read ahead, often to the M2 that resets G54 and G17, and kept those modes although the machine never reached them. The coordinate system and plane set before the program were lost, and #5220 saved at exit kept G54. An operator abort already brings the interpreter back to the modes of the last executed move with emcTaskStateRestore(). Call it on the two error paths too, before the ON_ABORT_COMMAND routine runs, as on that abort. tests/abort/exec-error-modes sets G55 G18, runs into a soft limit with a G56 G19 and an M2 read ahead, and checks G55 G18 remain.
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.
Fixes #4715.
When motion rejects a move (a soft limit, for one) or motion or io report an error, task aborts the program. By then the interpreter has read ahead, often as far as the M2 that resets G54 and G17, and it keeps those modes although the machine never reached them. The coordinate system and plane set before the program are lost, and #5220 saved at exit keeps G54.
Repro on 2.9 and master alike, with or without
ON_ABORT_COMMAND:After the error the interpreter reports G54 G17. Interpreter errors (bad G-code, divide by zero) are not affected: the interpreter stops reading at the bad line.
Why: an operator abort already brings the interpreter back to the modes of the last executed move with
emcTaskStateRestore(), from the motion state tag. The two error paths (EMC_TASK_EXEC_ERRORand the motion/io RCS error) skip it. Pressing Abort afterwards does not help either: the tag is gone once motion clears its queue.Fix: call
emcTaskStateRestore()on those two paths, before theON_ABORT_COMMANDroutine runs, in the same order as the operator abort. It acts only in AUTO and only when the tag is restorable (not inside a remap or subroutine), as for the operator abort.Not covered: an error on the very first move of a program leaves nothing executed to restore from, so the read-ahead modes stay there, as before.
Test:
tests/abort/exec-error-modessets G55 G18, runs into a soft limit with a G56 G19 and an M2 read ahead, and checks G55 G18 remain. It fails without the fix (G17 G54) and passes with it.tests/abort,tests/remap,tests/motion-logger,tests/interp,tests/linuxcncrsh*andtests/haluipass. The same change on master passes the full suite excepttests/blendmath, the known GCC 14 build failure (#4670).On merge-up: master no longer reads
[EMCIO]EMCIO(io runs in task), so that line in the test'stest.inican be dropped there.