Waiting for a move to complete before returning OK
-
Hypothetical one here, not for printing or CNC use etc, just a 'what if' in my mind.
Say for example we're controlling a cartesian machine via Telnet, each time we issue a G1, G2, G3 etc - "ok" is returned as soon as the message is decoded, and the move is added to the motion queue.
If the machine sending commands to the controller needs to wait, to know when those moves are completed, before it does something else, how would we achieve that?
I see "M400: Wait for current moves to finish", but that does not control the return of "ok", does it?
In 'pseudo actions', this is what I'm imagining:
- PC sends G1 move
- controller sends 'ok' back to confirm decode of message
- controller forms move, move finishes
- controller sends back something that says "I'm done"
Is this possible?
A possible solution I can think of is to:
G1 X100 Y100 F1000 ; Issue move command
M400 ; Wait for it to finish
M117 P4 S"Done" L0 ; Send message via Telnet, which is the P4 argument. S is the message. L0 means don't log this message. -
@jwilo said in Waiting for a move to complete before returning OK:
G1 X100 Y100 F1000 ; Issue move command
M400 ; Wait for it to finish
M117 P4 S"Done" L0 ; Send message via Telnet, which is the P4 argument. S is the message. L0 means don't log this message.This makes sense to me.
-
I ran some tests tonight, rather it appears to be simpler than this.
Combining M400 onto the same line, delays the return of "ok", i.e.
G1 X100 Y100 F1000 M400
However, what if you want to receive the "ok" as confirmation of receipt, followed by "done". The following appears to do it, but if you don't send the M400 before the move finished, it doesn't work, which for very short moves is quite likely...
G1 X100 Y100 F1000 M400 M117 P4 S"Done" L0
-
@jwilo of possible use to you is nanoDLP compatibility mode. See https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m555-set-compatibility. In this mode, after any G0 or G1 command that is not in a macro file, RRF waits for the move to complete and then reports "Z move comp" and then "ok".
-
@dc42 thanks David, does that apply to any axis, not just Z? I may be reading too much into the meaning of the "Z move comp" response...
-
@jwilo I am currently out of the office but AFAIR it applies to all movement.