Power Loss Resume Function in Klipper
- The Power Loss Resume function in Klipper refers to the ability to automatically restore the printing state of Klipper after it loses power and is powered again.
- C8P can be used without KPPM
- Not suitable for models where the Z-axis may shift after a power outage.
Configuration
Disable Power Off Shutdown
Notes
- Power Off Shutdown needs to be disabled, otherwise the Power Loss Resume function cannot be used.
- There is an automatic shutdown function after saving the progress in the Power Loss Resume.
- Please ensure that there is no other power connected to the host, otherwise it will not be able to start.
-
Enter the device's IP address in the browser's address bar, for example:
http://192.168.6.179
-
Enter the configuration page
- Open the device ip address in the browser, for example:
http://192.168.1.2/
- In fluidd, uncheck as shown on the left in the figure.
- In mainsail, check as shown on the right in the figure.
- At this point, you can see the
.flyos-config
folder, entering this folder will have thesys-config.conf
file. - The
sys-config.conf
file is a soft link to theconfig.txt
file in the removable diskFlyOS-Conf
.
- Open the
sys-config.conf
file, find the configurationsshutdown_pin_state
andshutdown_pin=
- Add
#
before these configurations - Then
Save
->Close
and restart
- Open the device ip address in the browser, for example:
plr.cfg Configuration File
Notes
- In the printer configuration page, find the
plr.cfg
file. - Clear the content of it, then paste the following configuration into it
- The configuration file content is as follows:
[mcu host]
serial: /tmp/klipper_host_mcu
[power_loss_resume]
power_pin: !host:gpiochip0/gpio260
is_shutdown: True # Whether to perform shutdown operation, default is enabled
paused_recover_z: -2.0 # Z movement distance when resuming print if stopped, default is no movement
start_gcode:
# Gcode to execute before resuming print
# All parameters saved before power loss can be obtained through {PLR}
# Use M118 {PLR} to output all available parameters
M118 Resuming print: {PLR.print_stats.filename}
M118 Position at interruption: X:[{PLR.POS_X}] Y:[{PLR.POS_Y}] Z:[{PLR.POS_Z}] E:[{PLR.POS_E}]
M140 S{PLR.bed.target} ; Set bed temperature
M104 S{PLR.extruder.target-10} ; Set extruder temperature
M109 S{PLR.extruder.target-10} ; Wait for extruder to heat up to set temperature
G91 ; Relative coordinates
G1 Z2 F100 ; Lift Z, prepare to home X,Y
G90 ; Absolute coordinates
G28 X Y ; Home X Y
M140 S{PLR.bed.target} ; Set bed temperature
M104 S{PLR.extruder.target} ; Set extruder temperature
M190 S{PLR.bed.target} ; Wait for bed to heat up to set temperature
M109 S{PLR.extruder.target} ; Wait for extruder to heat up to set temperature
M83 ; Relative extrusion
# G1 E0.5 F400 ; Extrude a little
layer_count: 2 # Execute layer_change_gcode after resuming specified layers
layer_change_gcode:
# Gcode to execute after resuming {layer_count} layers
M118 Resume print speed
M106 S{PLR.fan_speed} ; Turn on cooling fan
M220 S{PLR.move_speed_percent} ; Set requested speed percentage
M221 S{PLR.extrude_speed_percent} ; Set requested extrusion speed percentage
shutdown_gcode:
# Gcode to execute before shutdown
M118 Low power voltage, shutdown
# M112 ; Emergency stop
-
After saving the above configuration file
-
Open the
printer.cfg
file, and add the following content at the beginning of the file:
[include plr.cfg] -
Click Save and Restart in the top right corner.
-
At this point, the Power Loss Resume function in Klipper has been configured.
Notes on [homing_override]
Notice
- Note that if you use
[homing_override]
, you should not set the homing position arbitrarily in[homing_override]
. The failure of the Power Loss Resume function caused by this will not be responsible. - Below is the configuration description of
[homing_override]
- Description
[force_move]
: Enable the force move function, allowing to move to a specified position.[force_move]
replaces theset_position_z
function in[homing_override]
. If not configured as described, it may cause the Power Loss Resume function to fail.- The following
[homing_override]
configuration is to ensure correct homing of the Z-axis during Power Loss Resume.
[force_move]
enable_force_move: true
[homing_override]
axes: z
gcode:
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'X' in params %}
G28 X
{% endif %}
{% if home_all or 'Y' in params %}
G28 Y
{% endif %}
{% if home_all or 'Z' in params %}
G0 X{max_x / 2} Y{max_y / 2} F3600
G28 Z
G1 Z10 F2000
{% endif %}
- Notes on lifting
- This configuration is executed only when the Z-axis is not homed, and this configuration does not affect normal use
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}
Test
- Print any file, click the
Emergency Stop
button during printing to simulate a power outage. - Click
Firmware Restart
again, wait for Klipper to connect normally. - If a pop-up window appears on the web page or KlipperScreen, it indicates that the Power Loss Resume function is working properly.
- You can continue to test real power outages later.
Loading...