Emergencyish stop



  • Just wondering if theirs any g code that can simply cancel the print. I know m112 rests the board but i wanted something just stopping a failed print.

    thanks




  • Moderator

    Pause and Cancel?



  • @Phaedrux
    yea mainly cancel. basically if i have a bad first layer i just want it to cancel the print and put some gcode to lower the z axis.



  • @davidvh86 said in Emergencyish stop:

    @Phaedrux
    yea mainly cancel. basically if i have a bad first layer i just want it to cancel the print and put some gcode to lower the z axis.

    And baby stepping doesn't meet your needs - at least it terms of completing the print?

    Frederick


  • Moderator

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

    The firmware finishes any moves left in its buffer, then it executes the macro file cancel.g if present, if the axes are homed and if a print is being cancelled. Otherwise it attempts to run sleep.g if present before all motors and heaters are turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0, M112.

    If Marlin is emulated in RepRapFirmware, this does the same as M25 if the code was read from a serial or Telnet connection, else the macro file sleep.g is run before all heaters and drives are turned off.



  • @Phaedrux said in Emergencyish stop:

    The firmware finishes any moves left in its buffer, then it executes the macro file cancel.g if present, if the axes are homed and if a print is being cancelled. Otherwise it attempts to run sleep.g if present before all motors and heaters are turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0, M112.
    If Marlin is emulated in RepRapFirmware, this does the same as M25 if the code was read from a serial or Telnet connection, else the macro file sleep.g is run before all heaters and drives are turned off.

    sorry im still fairly new to duet, what happens if a cancel.g or sleep.g are not present, and if they were what would they contain, like a list of my own gcode after the stop was triggered, such and shutting off the hotend, chamber since only the moves would be canceled ?


  • Moderator

    @davidvh86 said in Emergencyish stop:

    what happens if a cancel.g or sleep.g are not present

    I think the "before all motors and heaters are turned off. " covers the case where neither are present.

    I don't use sleep.g myself, but I do have a pause.g and cancel.g

    ; pause.g
    ; called when a print from SD card is paused
    G10		; retract filament
    G91		; relative positioning
    G1 Z5 F600	; lift Z by 5mm
    G90		; absolute positioning
    G1 X10 Y10 F10000	; go to X=0 Y=0
    
    ; cancel.g
    ; Run when the print is paused, and then canceled.
    G10 P0 R0 S0		; Set hotend temp to 0
    M140 S0			; Set bed temp to 0
    M106 S255 		; Fan at 100 to cool nozzle and bed
    M220 S100		; Set speed factor back to 100% in case it was changed
    M221 S100		; Set extrusion factor back to 100% in case it was changed
    M204 P1000 T4000	; Set printing and travel accelerations
    M566 X900 Y900 Z30 	; Set maximum instantaneous speed changes (mm/min) (Jerk)
    G28 XY			; home XY
    M84			; turn off steppers
    G4 S60			; wait 1 minute for nozzle to cool
    M107			; turn off the fan
    

    As you can see cancel basically just turns off the heaters and motors with a little bit of extra detail.



  • @Phaedrux

    sweet thanks examples are a huge help. I appreciate all your help btw, You made this project go a lot smoother, probably would have taken twice as long to finish lol.


  • Moderator

    No problem. Glad I could help.

    The gcode wiki is a great resource. You should always have it open in a tab. Any time you're wondering if you can do something or how something works, searching the wiki there can be a big help.

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

    Since everything is configured with gcode, and there is basically a gcode for everything, and anything can be configured on the fly, anything you can think of doing, you can probably do.


Log in to reply