Klipper Power Loss Resume Functionality
Overview
- The Klipper power loss resume function refers to the ability of Klipper to automatically restore its printing status after being powered off and then powered on again.
- This feature requires the use of a safety shutdown module.
- It is not applicable for machines where the Z-axis will move when power is lost.
Configuration
Disable Power-off Shutdown
Notice
- The power-off shutdown must be disabled; otherwise, the power loss resume function cannot be used.
- There is an automatic shutdown after saving progress in the power loss resume process.
-
Enter the device's IP address in the browser's address bar, for example:
http://192.168.6.179
-
Access 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 below ->
Hide hidden files and folders
. - In mainsail, check as shown on the right in the figure below ->
Show hidden files
.
- You can now see the
.flyos-config
folder. Inside this folder, there is asys-config.conf
file. - The
sys-config.conf
file is a symbolic link to theconfig.txt
file in the removable diskFlyOS-Conf
.
- Open the
sys-config.conf
file and locate the configurationsshutdown_pin_state
andshutdown_pin=
. - Add a
#
before these configurations. - Then save and close, and restart the system.
- Open the device IP address in the browser, for example:
plr.cfg Configuration File
-
Find the
plr.cfg
file in the printer configuration page. -
Clear the content inside and paste the following configuration:
[mcu host]
serial: /tmp/klipper_host_mcu
[power_loss_resume]
power_pin: !host:gpiochip0/gpio260 # Shutdown pin of the safety shutdown module connected to PA21 pin on the host machine
is_shutdown: True # Whether to execute shutdown operation, default is enabled
paused_recover_z: -2.0 # Z movement distance during recovery if paused at shutdown, default is no movement
start_gcode:
# G-code to run before resuming print
# All parameters saved before power loss can be accessed via {PLR}
# Use M118 {PLR} to output all available parameters
M118 Start Resuming Print: {PLR.print_stats.filename}
M118 Interrupt Position: 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 until extruder reaches set temperature
G91 ; Relative coordinates
G1 Z2 F100 ; Lift Z, prepare for X,Y homing
G90 ; Absolute coordinates
G28 X Y ; Home XY
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 reach set temperature
M109 S{PLR.extruder.target} ; Wait for extruder to reach set temperature
M83 ; Relative extrusion
# G1 E0.5 F400 ; Extrude a bit
layer_count: 2 # Number of layers to resume before executing layer_change_gcode
layer_change_gcode:
# G-code 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 extrude speed percentage
shutdown_gcode:
# G-code to run before shutdown
M118 Low Power Voltage, Shutting Down
# M112 ; Emergency stopNote- The macros in the
start_gcode
above may need modification based on the specific machine's situation.
- The macros in the
-
After saving the above configuration file,
-
Open the
printer.cfg
file and add the following content at the very beginning of the file:
[include plr.cfg] -
Click the top-right "Save and Restart" button to apply the changes.
-
At this point, the Klipper power loss resume function has been configured.
Testing
- Start printing any file. During the print process, click the "Emergency Stop" button to simulate a power outage.
- Click "Firmware Restart" again. Once Klipper reconnects normally,
- If a pop-up prompt appears on the webpage or KlipperScreen, it indicates that the power loss resume function is working correctly.
- Further testing with real power outages can be conducted afterward.