-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
linuxcnc.stat 'mcodes' attribute is broken #3186
Comments
I guess that m_codes array (size 10) is zero-initialized, and nothing is writing to array index 9, so therefore that always contains 0 and will be displayed as M0. should go away with array initialized to -1. why it was designed that way... who knows. would be cleaner to replace that (and active g-codes) with an actual std::vector but that probably won't fly with NML. |
Thanks for your comment. Problem is I cannot seem to find the initialization of the array. My current 'solution' is to simply not copy the last element:
|
In C++ that happens implicitly (to 0) |
This looks like a contradiction to me: In interp_write.cc: 314
rs274ngc_pre.cc: 2214
If I combine the two sections this would be equivalent to:
Dropping the double negation:
But in rs274ngc_pre.cc: 163 (which looks correct)
|
This seems to indeed fix the spindle field:
As for the erroneous '0' in the last array element:
This seems to fix the issue (not sure if there is a more elegant solution though) :
|
I've been looking into getting 'M0' and 'M1' tag to show when running Gcode. The problem seems to be that while Gcode execution is paused due to 'm0' or 'm1' the status information given is from the line before the actual 'M0'/'M1' command. |
I think that StateFlags was imported from a version of LinuxCNC without multiple spindles (ie, Pathpilot) |
would it make sense to set SPINDLE_ON to 1 if at least one spindle is running? (OR of all spindle-states). not so clear what to do with CW/CCW. |
M0/M1 command doesn't get a state tag so at the realtime end nobody knows about it. compare https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/task/taskintf.cc#L1397 and https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/task/taskintf.cc#L1304. Though I'm not sure if simply setting the state tag in emcTrajPause will be enough. |
This is what happens in a number of other places where the data structure dues not allow for individual spindle statuses. |
Seems only commands with actual machine movment get a state tag:
which is probably why the 'current_line' attribute seems to always point to the line with the last actual move. |
I've added two debug prinf statements like this: I'm running this Gcode:
And it looks like the 'EMC_TRAJ_PAUSE_TYPE' case in 'emctaskmain.cc' is not executed at all:
|
an additional problem is that the interpreter is coalescing commands that have no side-effects, that's the reason you can only single-step (if it works at all) from one move to the next. |
you can turn on debugging of "interpreter" and "interpreter list", that shows all communication from interp. The message you are looking for is EMC_TASK_PLAN_OPTIONAL_STOP or EMC_TASK_PLAN_PAUSE and those don't come with a state tag. |
Also look at master, I refactored a bunch of that stuff to prepare for an alternative transport besides NML, and things do look a bit different there (using std::unique_ptr etc... instead of naked pointers with non-obvious ownership / lifetime) |
Thanks , I am using master. |
Tested on RIP installs of current 2.9 and master and a package install of 2.9.3.
Here are the steps I follow to reproduce the issue:
This is what I expected to happen:
I would not expect 'M0' to be shown as active
I would expect 'M5' to change to 'M3' as the gcode executes
This is what happened instead:
'M0' is shown as active
'M5' quickly changes to 'M4' (!) and then back to 'M5' as the gcode executes
It worked properly before this:
Not sure if this worked before current version 2.9
The text was updated successfully, but these errors were encountered: