Skip to content

interp: don't restore spindle speed on abort state restore - #4473

Open
grandixximo wants to merge 1 commit into
LinuxCNC:2.9from
grandixximo:fix-4465-abort-spindle-2.9
Open

interp: don't restore spindle speed on abort state restore#4473
grandixximo wants to merge 1 commit into
LinuxCNC:2.9from
grandixximo:fix-4465-abort-spindle-2.9

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Backport of #4467 to the 2.9 branch.

On abort, emcTaskStateRestore() runs restore_from_tag(), which builds a G-code restore string from the difference between the motion state tag and the interpreter readahead state. gen_settings() unconditionally appends the saved S word, so after an early abort the restore queued EMC_SPINDLE_SPEED after the abort's spindle stop, turning the spindle back on. Aborting late in a program was unaffected because tag and readahead agree by then.

Fix: exclude the spindle speed setting from the abort restore, as is already done for M codes. The M72 restore_settings() path keeps restoring it, since there the S word must take effect mid-program.

Verified headless on a 2.9 sim with the program from the issue's forum thread: abort near the start restarted the spindle to 3000 rpm before the fix and stays off after.

On abort, restore_from_tag() executes a G-code string built from the difference between the motion state tag and the interpreter readahead state. gen_settings() unconditionally appends the saved S word, so after an early abort the restore queued EMC_SPINDLE_SPEED onto the interp_list and it was issued after the abort's spindle stop, turning the spindle back on. Late aborts were unaffected because tag and readahead state agree by then and no restore command is generated.

Exclude the spindle speed from the abort restore, as is already done for M codes. The M72 restore_settings() path keeps restoring it, since there the S word must take effect mid-program.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant