Skip to content

Fix misleading machine state information after program abort #3459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Sigma1912
Copy link
Contributor

This fixes issues #2745 and #2908 and adds clarification to the documentation

The current situation of not resetting the controller after a program abort leaves parameter values and the status channel out of sync. This causes the DRO to display wrong information about axis position and offset values after a program abort.
The new default behavior (if no [RS274NGC] ON_ABORT_COMMAND entry is found in the ini file) is to issue 'M2' on a program abort which correctly resets and synchronizes the parameter values and the status channel.

…abort

This fixes issues LinuxCNC#2745 and LinuxCNC#2908 and adds clarification to the documentation
@BsAtHome
Copy link
Contributor

BsAtHome commented Jun 4, 2025

The patch fails these tests:

  • tests/abort/feed-rate
  • tests/motion-logger/basic
  • tests/motion-logger/startup-gcode-abort
  • tests/statbuffer-g5x-abort

Are these side effects or problems?

@Sigma1912
Copy link
Contributor Author

Oh my, I forgot the tests. I'll need to have a look at those.
Thanks.

@Sigma1912 Sigma1912 marked this pull request as draft June 4, 2025 12:21
@Sigma1912
Copy link
Contributor Author

I get these results:

Runtest: 260 tests run, 255 successful, 4 failed + 1 expected, 1 skipped
Failed: 
	/home/user/git/mylinuxcnc-repo/tests/abort/feed-rate
	/home/user/git/mylinuxcnc-repo/tests/motion-logger/basic
	/home/user/git/mylinuxcnc-repo/tests/motion-logger/startup-gcode-abort
	/home/user/git/mylinuxcnc-repo/tests/statbuffer-g5x-abort

This expects the feed-rate to remain unchanged but with this PR feed-rate is reset to zero

Running test: /home/user/git/mylinuxcnc-repo/tests/abort/feed-rate
*** /home/user/git/mylinuxcnc-repo/tests/abort/feed-rate: XFAIL: test run exited with 1

With this PR an abort resets spindle-synchronisation.

Running test: /home/user/git/mylinuxcnc-repo/tests/interp/m98m99/12-M99-endless-main-program
--- expected.motion-logger	2025-06-04 12:39:47.413552065 +0200
+++ out.motion-logger	2025-06-04 14:35:39.697162112 +0200
@@ -192,6 +192,7 @@
 ENABLE_AMPLIFIER
 ENABLE_AMPLIFIER
 ENABLE_AMPLIFIER
+SET_SPINDLESYNC sync=0.000000, flags=0x00000000
 COORD
 JOG_ABORT joint=0
 JOG_ABORT joint=1
*** /home/user/git/mylinuxcnc-repo/tests/interp/m98m99/12-M99-endless-main-program: XFAIL: checkresult exited with 1

With this PR an abort resets spindle-synchronisation.

Running test: /home/user/git/mylinuxcnc-repo/tests/motion-logger/basic
*** /home/user/git/mylinuxcnc-repo/tests/motion-logger/basic: XFAIL: test run exited with 1
Running test: /home/user/git/mylinuxcnc-repo/tests/motion-logger/mountaindew
Running test: /home/user/git/mylinuxcnc-repo/tests/motion-logger/startup-gcode-abort
--- expected.motion-logger	2025-06-04 14:42:04.769566055 +0200
+++ out.motion-logger	2025-06-04 14:42:06.382454724 +0200
@@ -109,3 +109,5 @@
 JOG_ABORT joint=15
 ABORT
 SPINDLE_OFF
+SET_SPINDLESYNC sync=0.000000, flags=0x00000000
+SPINDLE_OFF
*** /home/user/git/mylinuxcnc-repo/tests/motion-logger/startup-gcode-abort: XFAIL: checkresult exited with 1

This expects the work offset system to remain unchanged but with this PR work offset is reset to default g54

Running test: /home/user/git/mylinuxcnc-repo/tests/statbuffer-g5x-abort
*** /home/user/git/mylinuxcnc-repo/tests/statbuffer-g5x-abort: XFAIL: test run exited with 1

Seeing this I feel that this PR cannot be merged into 2.9 and would seem to require discussion about changing abort behavior in general even in master.
Personally I would argue that retaining such settings as feed-rate, work-offset, spindle-synchronization and possibly other things doesn't really make sense on a program-abort event.
It may however be an advantage when using MDI.
Maybe another fix for the mentioned issues can be found.

@Sigma1912 Sigma1912 closed this Jun 4, 2025
@Sigma1912 Sigma1912 reopened this Jun 4, 2025
@Sigma1912
Copy link
Contributor Author

After some more testing I've decided to reopen this as a draft for discussion.

The current default behavior on abort during a gcode program ending in 'm2' or 'm30' is just crazy. Not even the displayed axis positions can be trusted let alone any of the displayed active gcodes. G92/G52 offset values in the offset pages are showing zeros when the actually applied offset is non-zero.

@Sigma1912 Sigma1912 changed the title Fix disagreement between parameters and status channel after program abort Fix misleading machine state information after program abort Jun 4, 2025
@andypugh
Copy link
Collaborator

andypugh commented Jun 5, 2025

It is probably worth asking for discussion on the developers mailing list.

@Sigma1912
Copy link
Contributor Author

Not a viable fix as the 'm2' would also be executed on program stop and faulty mdi commands.

@Sigma1912 Sigma1912 closed this Jun 5, 2025
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.

3 participants