Stepping a program - bug or feature?

More
20 Oct 2021 13:05 #223663 by spumco
I've been trying to set up my external program controls (cycle-start, single-block, etc.) and discovered something that is confusing me.

Load a program, press cycle-start (on screen, or external using halui.program.run) and LCNC runs through the program one line at a time.  So far, so good.

When I use program step mode, the behavior changes depending on the G-code.  If a line has movement pressing step (or halui.program.step) will execute one line and then LCNC waits for another input.

However, if the G-code line has no movement in it pressing step once will continue executing line after line until it reaches a line with movement.  That line with movement will be executed and only then LCNC stops.

GUI being used makes no difference, nor if on-screen buttons or external controls using halui.program.whatever are used.

Example 1 (expected behavior)
[press STEP]
G1 X0 F10 <= line is executed, LCNC stops here
[press STEP]
G1 X1 F10 <= line is executed, LCNC stops here
G1 X0
G1 X1
G1 X0
M30

Example 2 (unexpected behavior)
[press STEP]
G1 X0 F10 <= line is executed, LCNC stops
[press STEP]
G1 X1 <= line is executed, LCNC keeps going
M8 <= line is executed
G4 P1 <= line is executed
M9 <= line is executed
G4 P1 <= line is executed
M8 <= line is executed
G4 P1 <= line is executed
G1 X1 F10 <= line is executed, LCNC stops here
G1 X0
M30

This behavior does not match any other controller I've used (Mach3, UCCNC, Fanuc, HAAS, Siemens, Fadal).  In all other controllers, single-block (or whatever it's called) will execute one line of code and that's it.

Is this a bug or expected/desired behavior?  I realize it's unusual to have many non-movement lines of code, but I'd like to understand the intended behavior of LCNC and there's nothing in the documentation about this particular detail.

Thanks,
Ralph

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 13:10 #223664 by andypugh
I think that it is intended, or at least it is inherent to the way that LinuxCNC works.

Motion commands have serial numbers, and are queued with a serial number.
Modal commands don't get serial numbers, and the controller has no idea if they came from one or many program lines.
The following user(s) said Thank You: spumco

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 13:19 #223666 by spumco
Thanks Andy, at least I'm not crazy watching my machine plow through line after line even though I've got it in 'single-block' mode.

I wonder if this applies to M-codes that don't have direct G-code commands... i.e. a tool-change sequence?

Can you envision a scenario where you are in single-block/step and the next line is a tool-change with re-mapped M6?

If there's no explicit G0/G1/G2/G3 move in the remap, is it possible for LCNC to execute the tool change (or similar sequence with physical movement) even though the operator stopped at the preceding line?

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 13:21 #223668 by tommylight
I wonder if it stops after adding F10 to each line ???

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 13:28 #223670 by spumco
It does not.  I tried it both ways.  Any movement line stops until cycle-start, step, or whatever the button equivalent is pressed.  The movement line does not require an F-word.  The F-word (modal feedrate) is carried through to the next line.

I've not tested every single non-movement G-word or M-word, but my stupid little "flash the flood light to check button function" is what triggered this whole thing.  M8 does it, G4 dwells do it, M9, M7.

I didn't have the guts to try an M3/M4 just yet...

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 14:15 #223673 by tommylight
Thank you, was just curious .

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 14:38 #223675 by spumco
I'm going to try it with an M3/M5 in the program tonight - will report back later.

Can anyone else think of a potentially dangerous modal command to test?

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 14:47 #223676 by anfänger
M64 or M65 could bring you into trouble depends on what you switch with them. What about user Mcodes?

Please Log in or Create an account to join the conversation.

More
20 Oct 2021 14:56 #223678 by spumco
Good one - I'll try those too.

I'll connect an output to M64/M65 in my test HAL and add it to the "Single-block-roulette" file tonight.

We can pretend M64 turns on the part-loader robot automatic sequence. Wouldn't that be fun to have execute without being ready for it?

 

Please Log in or Create an account to join the conversation.

More
21 Oct 2021 02:51 #223755 by spumco
Update after testing:

Feed hold and then stepping through a program only appears to stop at axis movement lines.  All other modal g-code words I tested will be executed.

It's a little disconcerting watching the spindle turn on 10 lines down from where you stopped it and requested a single step/line.

I don't have a tool changer or my manual M6 set up, but M3/4/5, M7/8/9, and M64, M65 all executed automatically with a single step.

The other thing that made me anxious was that the active code line indicator (little arrow) in the program window stopped at the point where I did a feedhold, despite subsequent lines being executed.  The indicator then jumped down through the program when it had finished all the 'test' code lines to the first motion line.

I know my test program(s) were pretty far-fetched (lots of M8/M9's), but I think it reasonable to single-block/step through an unfamiliar program to a tool change and expect the spindle & coolant to NOT turn on until you plan on it.

If anyone else can spare the time to test this with some user M-codes or other potentially dangerous conditions I'd appreciate it.  I'm very new at LCNC and don't want to assume LCNC is 'broken' or that single-block needs to be treated with utmost caution until someone more experienced confirms my suspicions.

Thanks,
Ralph

Please Log in or Create an account to join the conversation.

Time to create page: 0.146 seconds
Powered by Kunena Forum