One-press resume printing after power failure



  • Can you update the firmware on the v085 boards to automatically do whatever is necessary so that prints can be resumed by the end user after a power failure?


  • administrators

    The version 085 board doesn't have power fail detect circuitry, so it doesn't create a resurrect.g file when the power fails. You can still pause the print manually, turn off the power, and resume it later.



  • Ok thanks I will try that now



  • How do I resume the print after manually pausing and turning off the power?

    The "Resume" button is gone now, and I don't see how to get to sys/resurrect.g , am I missing a button? The "Go up^" directory button doesn't do anything when I click it.

    I know depending on screen resolution some buttons don't show up

    Is there a console command for running the sys/resurrect.g file?

    Edit:

    Use the system files editor in DWC to see whether resurrect.g was actually created. There needs to be a certain amount of power in reserve for it to be created, and with 12V power that's less likely.

    Re: Power Failure

    I see the file now, I'll try to run

    After the power is restored, you can use command M916 to resume the print from where it stopped. This command runs file sys/resurrect.g which calls sys/resurrect-prologue.g at an appropriate point to home the printer

    duet3d.dozuki.co........power_failure



  • At the very least, your sys/resurrect-prologue.g file must do the following:

    Home the printer, without crashing the head into the print. On a delta, or on a Cartesian or CoreXY printer with a Z max homing switch, you can home all axes. On other types of printers you may have to skip homing Z and use a G92 command to tell the printer the current Z coordinate.

    I have a CoreXY with ZMIN homing switch, How do I find out what value to set the G92 command to, to avoid a crash, or does the resurrect file take care of this, and I just home X and Y ?

    Re: How to correctly setup power failure detection/resurrection in 1.20?

    I guess it would be possible to have the firmware put a G92 Z command in the resurrect.g file to tell it what the Z coordinate was when the print stopped.

    This would certainly help. Otherwise I guess the only way to know is to just write down whatever height Z is at when you pause?


  • administrators

    Firmware 1.20 and later create a resurrect.g file whenever you pause the print.



  • @duetfan223 said in One-press resume printing after power failure:

    I guess it would be possible to have the firmware put a G92 Z command in the resurrect.g file to tell it what the Z coordinate was when the print stopped.

    This would certainly help. Otherwise I guess the only way to know is to just write down whatever height Z is at when you pause?

    Problem here is, that when power is turned off the motor might/will jump from a micro-step position to a full-step position and that will change its real position after the known position was written to resurrect.g.


  • administrators

    @wilriker said in One-press resume printing after power failure:

    @duetfan223 said in One-press resume printing after power failure:

    I guess it would be possible to have the firmware put a G92 Z command in the resurrect.g file to tell it what the Z coordinate was when the print stopped.

    This would certainly help. Otherwise I guess the only way to know is to just write down whatever height Z is at when you pause?

    Problem here is, that when power is turned off the motor might/will jump from a micro-step position to a full-step position and that will change its real position after the known position was written to resurrect.g.

    That's why we make provision for you to re-home the printer in your resurrect.g file. See https://duet3d.dozuki.com/Wiki/Setting_up_to_resume_a_print_after_a_power_failure.



  • I think the actual Z position is not written to the resurrect.g file, is it?
    On a printer with z-min homing like a regular cartesian or CoreXY this is basically useless...?

    I understand the problems and everything - but maybe at least write the last Z position into the file (as a comment) so the user can manually use G92 Z.


  • administrators

    @resam said in One-press resume printing after power failure:

    I think the actual Z position is not written to the resurrect.g file, is it?
    On a printer with z-min homing like a regular cartesian or CoreXY this is basically useless...?

    I understand the problems and everything - but maybe at least write the last Z position into the file (as a comment) so the user can manually use G92 Z.

    Of course there is a command to move the head to the correct Z position to resume the print, without it the print couldn't be resumed. You will find it in the resurrect.g file.



  • Yes - the movement command is there - but at this point I might not have my Z homed yet (or used G92 for that matter). If I want to resume, I first need to look into the resurrect.g file, search for the first G0/1 command with a Z component, and then use G92 with that Z value to "home" my Z. Only then can I use the resurrect to resume my print.

    Not very intuitive or easy to use.
    I would propose to at least add a comment at the top of the file:

    ; Z height before power was lost: 12.5mm
    ; Z height after running the "auto save on loss of power" g-codes: 15.5mm
    

    Ideally M911 would be aware of my Z-homing disability and simply show me a M291 error message so I am reminded to use G92 first.



  • @resam you are in control of the resurrect prologue macro. You can define however you want to home the z there.

    I agree it would be beneficial to call out the saved z height in a more accessible place though.

    I added an optical endstop for zmax on my corexy and made a zmax homing macro for this purpose. Can't you do the same?



  • @Phaedrux well, ideally I don't want to move my leadscrew-driven bed at all!

    They are self-locking, so in the case of a power outage they will not move.

    They might shift due to microstepping switching into the next position, but I think I can live with that on a TR8x2 and 0.9° steppers ; with 3200 steps/mm.



  • @resam agreed. I'm on triple tr8*1 belted to a single 0.9 motor. 6400 steps. With the power off I can't even push the bed down.

    But as I said, you can script out the resume-prologue to set z however you like. For instance this should get you what you want if you have your z axis max travel measured accurately. Just replace G92 Z300 with whatever your zmax is.

    ; resurrect-prologue.g
    ;
    ; Called by resurrect.g after a resume from powerloss.
    ; 
    
    G28 XY			; Home X and Y
    M291 S3 Z1 R"Set Z Position to Z Max"
    G92 Z300
    M116			; Wait for temps
    M83			; Relative Extrusion
    G1 E2 F1000		; Undo retraction and prime nozzle
    
    ; Returns to resurrect.g to resume print
    


  • Thanks @Phaedrux - this looks interesting!
    Right now I have no idea what my Zmax actually is - I've never traveled there... 😄
    Guess I should setup an accurate endstop or indicator...

    Still, I would prefer if I don't have to move my bed at all, if possible.

    Too bad g-code has no variables or placeholders. I think this would have been a good use case (at least in my narrow-minded workflow 😸 )



  • @resam well you don't have to move the bed at all really. If it hasn't dropped at all you can simply modify that macro before you print the resurrect file and change the G92 Z value to be the final z height from the time of power loss. You'd still have to dig it out yourself though.



  • Yes - thats what I'm complaining about 😛
    I don't want to go digging around to find the Z value.

    It would be nice to at least put it at the top of the file in a nice comment.

    Even better would be some sort of integration / M291 magic - but this might be highly specific to each printer type, so I'm not putting my hopes up.



  • @resam said in One-press resume printing after power failure:

    I would propose to at least add a comment at the top of the file:

    ; Z height before power was lost: 12.5mm
    ; Z height after running the "auto save on loss of power" g-codes: 15.5mm
    

    From what I can see in the source code at least the first line should be fairly easy to add.
    I would be a little bit concerned with the second one as this is the height of Z if and only if there was enough power left to move Z - and this could even be only a partial movement.

    Here we come to a point of uncertainty on my side as the code here is rather complex: AFAICT the file is written before running the M911 P part so at this time it is unknown whether this will succeed or not - and at the time it is known the file is closed and probably not enough power left to append this info either.
    This might be confirmed by @dc42.



  • Yes there is uncertainty - thats why I think adding both values would be good.
    The user should check & verify the current Z height against these two values before proceeding.
    I guess I could deduct the second value myself by looking at my M911 command list... but this would be yet another file to check...



  • @resam said in One-press resume printing after power failure:

    The user should check & verify the current Z height against these two values before proceeding.

    But how do you reliably check whether Z has moved 2mm away or only 1.92mm - or any value in between. The nozzle of my printer is surrounded by stuff, so I would have no chance to get anything between the nozzle and the print to accurately measure this distance. Of course ball-park-numbers of full mm should be doable but finer then this... I don't see a chance.

    What could be done with the first value (but that would still be extra manual work) would be to move the nozzle back manually onto the print (at best before heating up to not damage the print) and then set Z height based on what's in the comment. But at least the comment would help in that case.


    I just had another look at the source code. The Z height is already in the file. It should be the third to last command

    G0 F6000 Znnn <---
    G1 Fnnn
    M24
    

    where nnn denotes the Z height at pausing.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.