Pause without delay



  • Hi everybody

    In tfree.g script, I need to pause without delay (in a if condition).

    Without delay I mean precisely at the moment I ask it. I can't wait for all the moves in the queue have been completed.

    I tried M25 and M226 without success. In the both cases some moves are finished before pausing.

    Any idea ?

    Thanks !

    M400
    G4 P500
    
    if sensors.gpIn[0].value = 1  ;if the microswitch is pressed...
    	M226
    	echo "Tool 0 still mounted (tfree)"
    


  • You have M400 preceding, so it must complete all moves in the buffer before executing the if statement.
    Also I think you should use M25

    M25 will run pause.g


  • Moderator

    https://duet3d.dozuki.com/Wiki/Gcode#Section_M25_Pause_SD_print

    M25: Pause SD print
    Example

    M25
    The machine pauses printing at the current position within the file. To resume printing, use M24. Do not use this code to pause the print in the currently printing G-code file, use M226 instead. M226 is intended for use in the GCode file being printed, for example to pause after a particular layer has completed. So it waits until all the moves in the queue have been completed. M25 is intended for use from a different source of GCodes (like the web interface console, PanelDue or Macro)

    Prior to pausing, the macro file pause.g is run. This allows the head to be moved away from the print, filament to be retracted, etc.



  • I tried wihtout M400 (and M25) => no success.

    I was not sure about the fact that M400 was the reason as it is placed before if condition. But I tried, without success.

    An other idea ?


  • Moderator

    There may be limits to how quickly a pause can be initiated due to the nature of the movement queue. @dc42 would have to confirm on the best way to do it.



  • Although it doesn't say it implicitly in the wiki for M25, it makes perfect sense that it finishes at least the move it is currently on before pausing.
    The printer has a limited scope of where it is at any moment.
    Instead it knows where it started and where it's going.
    If you pause in the middle of a G1 X0 to G1 X200 move, your resume point is most easily going to be one of those two points.
    You wouldn't want the first one as that's already been printed so the best compromise is to finish the line and have a clean start point.
    I would not be surprised if RRF is smarter and can in fact store a midpoint and recalculate the current move, but I wouldn't be disappointed if it didn't.


Log in to reply