Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe Z homing for Power Loss Recovery #16909

Merged
merged 17 commits into from
Mar 1, 2021
Merged

Safe Z homing for Power Loss Recovery #16909

merged 17 commits into from
Mar 1, 2021

Conversation

SwiftNick
Copy link
Contributor

@SwiftNick SwiftNick commented Feb 20, 2020

Requirements

Add option to home the Z axis during power loss recovery
During recovery, all axes are homed, then Z position is restored before X & Y

Description

Adds a parameters to the POWER_LOSS_RECOVERY block in configuration_adv.h
If enabled, during PrintJobRecovery::resume() will now

  1. raise Z by POWER_LOSS_ZRAISE
  2. home X & Y
  3. move to POWER_LOSS_ZHOME_XPOS and POWER_LOSS_ZHOME_YPOS
  4. home Z
  5. raise Z to saved Z position + POWER_LOSS_ZRAISE
  6. continue with standard print resume

The feature is disabled by default and will be blocked if Z_SAFE_HOMING is enabled.

Benefits

This allows print to resume after power loss if the Z position cannot be guaranteed provided that there is a safe region to home the Z axis

Modified files

configuration_adv.h
feature\power_loss_recovery.cpp
inc\SanityCheck.h

If printer loses the Z-axis position during power loss, it needs to be recovered safely during the power loss recovery stage.
1) Safely home the Z axis (assumes print can be avoided)
2) Restore the Z position before XY
@SwiftNick SwiftNick changed the title Add switch to restore lost Z-axis position during power loss recovery Add switch to home and restore Z-axis position during power loss recovery Feb 20, 2020
@thinkyhead
Copy link
Member

  • If the print head has fallen down due to a power-loss, the print is not recoverable.
  • We don't yet support the Anycubic Chiron.

@SwiftNick
Copy link
Contributor Author

SwiftNick commented Feb 21, 2020

The head drops about 2mm due to the pitch of the lead screw, but the print can be recovered, as at the point the power goes, the current z position is saved to the PLR file.
If Z is homed after power loss then the position is recovered just fine.
The machine is designed for this and Anycubic's custom firmware using v1.3.0 supports it too.

Regarding general support for the Chiron, I have written a new pin def, config file and an interface for the factory fitted TFT panel using the extensible UI API which together provides full support for the factory build Chiron.

Need to have a chat about how to do a PR for that, as it has dependencies for config files and core Marlin which are now 2 separate repositories.

Any suggestions welcome!

@tpruvot
Copy link
Contributor

tpruvot commented Feb 23, 2020

G28 Z might collide the half printed part...

@SwiftNick
Copy link
Contributor Author

Yes that is possible,
In the owners guide for the Chiron it states that the front 10cm of the bed MUST be avoided if you intend to use power loss recovery, otherwise you will hit the printed object.
This is how they have implemented it in their custom version of Marlin.

TBH it would have been better if they used a Z Axis lead screw with a shallower pitch , so the axis doesn't move when powered down.

@thinkyhead
Copy link
Member

I have a Chiron here, so I can assist with testing. I replaced its board before finding out that a special driver is needed before you can see it over USB, so I have to re-check my wires and maybe put back the original board because I did a sloppy job.

@studiodyne
Copy link
Contributor

studiodyne commented Mar 31, 2020

YES ITS RECOVERABLE , but with my idea , to add a ZMAX endstop instead of a ZMIN , the homing will low down the bed to find the endstop and will raise to the perfect z value

But , need to install a ZMAX endstop
All machine with bed that go down on shutdown must have a reverse homing , with the endstop on zmax , if not , recovery will ever be impossible

dtostrf(info.current_position.y, 1, 3, str_2)
);
gcode.process_subcommands_now(cmd);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad idea. You don't want to do a sideways move when Z is at the lower height. Power Loss Recovery currently does the sideways move before lowering the Z axis in order to avoid knocking over the model.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had swapped the Z and XY resume moves, but a better option would be to restore Z above the print before moving back to resume printing.

@8Moshe8
Copy link

8Moshe8 commented May 17, 2020

I think homing Z during power loss recovery as an option could be a great feature.
A good algorithm will be:

  • raising Z
  • homing XY
  • moving to a desired XY position (as specified by user in configuration_adv)
  • then homing Z
  • raising Z to the correct height
  • Resuming printing.
    An optional purge filament/continue sub menu like in filament change would help.

if the feature will be realized in the a similar way and users could disable it or customize it for their machines it would be great and a solid addition
I would greatly appreciate if it will be added in the future to Marlin 2.0

Standard resume now: 
1) raises Z by POWER_LOSS_ZRAISE
Added:
2) home XY
3) home Z
4) Raise Z to savedZ + POWER_LOSS_ZRAISE
Standard resume then:
5) restores XY
6) drops Z back to savedZ
7) resumes print.
@8Moshe8
Copy link

8Moshe8 commented Jun 7, 2020 via email

Settings added to specify a safe XY position to use for Z homing after power loss that avoids colliding with print.
@SwiftNick
Copy link
Contributor Author

I've added some options to the POWER_LOSS_ZHOME switch in Advanced Config so you can set a 'safe' position to restore z after power loss.
POWER_LOSS_ZHOME_XPOS and POWER_LOSS_ZHOME_YPOS
I need to look at the sanity check though as this may not work with Z_SAFE_HOMING

Cannot be used when Z_SAFE_HOMING enabled
@8Moshe8
Copy link

8Moshe8 commented Jun 8, 2020

I have modified the original powerloss.cpp file using SwiftNick`s code to fix the bugs that prevented hot end temperature from restoring.
I compiled the code and tested the feature on my ender 3 and it worked as expected like a charm.
How can I submit my changes?
I am new to GitHub and this will be the first time I can contribute something.

SwiftNick made changes to SanityCheck.h and configuration_adv.h
both those files are required.
I changed only powerloss.cpp to fix the issue above.

@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 3 times, most recently from 4274255 to a97a1ae Compare November 14, 2020 02:07
@thinkyhead
Copy link
Member

Brought this up to date with the latest settings and PLR behavior.

I added a G28 Z U with the plan to make "U" a new flag in G28 which will home the Z axis "unsafely" because G28 Z by itself will move XY to the "safe homing position" and that might not be what you want. But on the other hand, if you are using a probe and Z safe homing, you really should be avoiding this new option, so maybe it makes more sense to just forbid the new option when using Z safe homing.

@thinkyhead
Copy link
Member

Looks like that's covered already, so one more quick patch…

thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request Mar 1, 2021
@thinkyhead thinkyhead changed the title Add switch to home and restore Z-axis position during power loss recovery Safe Z homing for Power Loss Recovery Mar 1, 2021
@thinkyhead thinkyhead merged commit e66e51f into MarlinFirmware:bugfix-2.0.x Mar 1, 2021
thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request Mar 1, 2021
thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request Mar 1, 2021
vyacheslav-shubin pushed a commit to vyacheslav-shubin/Marlin that referenced this pull request Mar 10, 2021
vyacheslav-shubin pushed a commit to vyacheslav-shubin/Marlin that referenced this pull request Mar 10, 2021
W4tel-BiDi pushed a commit to W4tel-BiDi/Marlin that referenced this pull request Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants