Skip to main content

Power Loss Resume Function in Klipper

Overview

  • The Power Loss Resume Function in Klipper refers to the ability of Klipper to automatically restore the print status after power is restored following a power outage.
  • This function can be used only when combined with the FAST system.
  • PI-V2 requires the KPPM power loss module to be used.
  • Not suitable for machines where the Z-axis may experience displacement after a power outage.
  • Introduction to KPPM

Configuration

Disable Power Off Shutdown

Note
  • To use power loss resume, you need to disable power off shutdown.
  • The power loss resume has a function to automatically shut down after saving progress.
  • Make sure no other power supply is connected to the host, otherwise it will not start up
  • 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/
    • For fluidd, as shown on the left in the picture, uncheck -> Filter hidden files and folders.
    • For mainsail, as shown on the right in the picture, check -> Show hidden files.
    • At this point, you can see the .flyos-config folder, entering this folder will have the sys-config.conf file.
    • The sys-config.conf file is a soft link to the configuration file config.txt in the removable disk FlyOS-Conf.
    • Open the sys-config.conf file, find the configurations shutdown_pin_state and shutdown_pin=
    • Add # before these configurations
    • Then save -> close and restart

plr.cfg Configuration File

Note
  • Please replace the following in the configuration file: (PINS)
  • with host:gpiochip1/gpio21
  • In the printer configuration page, find the plr.cfg file.
  • Clear its content, then paste the configuration below
  • The configuration file content is as follows:
[mcu host]   
serial: /tmp/klipper_host_mcu

[power_loss_resume]
power_pin: (PINS)
is_shutdown: True # Whether to perform shutdown operation, default is enabled
paused_recover_z: -2.0 # If the print was paused when the power was lost, the Z movement distance when resuming, default is no movement
start_gcode:
# Gcode to be executed before resuming
# All parameters saved before power loss can be obtained through {PLR}
# You can use M118 {PLR} to output all available parameters
M118 Resuming print: {PLR.print_stats.filename}
M118 Interruption 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 for extruder to heat to set temperature
G91 ; Relative coordinates
G1 Z2 F100 ; Lift Z, prepare to zero X,Y
G90 ; Absolute coordinates
G28 X Y ; Zero 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 heat to set temperature
M109 S{PLR.extruder.target} ; Wait for extruder to heat 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 be executed 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 be executed 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 Klipper power loss resume function has been configured.

Notes on [homing_override]

Note
  • Note that if you use [homing_override], you cannot arbitrarily set the homing position in [homing_override]. If it causes failure of power loss resume, we are not responsible.
  • Below there is a description of the [homing_override] configuration.
  • Description
    • [force_move]: Enable the force move function, allowing to move to a specified position.
    • [force_move] replaces the set_position_z function in [homing_override]. If not configured as such, it may cause the power loss resume to fail.
    • The following [homing_override] configuration is to correctly home 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 only executes actions 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 appears on the web page or KlipperScreen, it indicates that the power loss resume function is working properly.
  • Subsequent tests can be done with real power outages.
Loading...
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -
- 3D Mellow -