Skip to main content

Power Loss Resume Function in Klipper

Overview

  • The Power Loss Resume Function in Klipper refers to the ability to automatically restore the print state of Klipper after it has been powered off and then powered back on.
  • This function can only be used with the FAST system.
  • PI-V2 requires a KPPM power loss module to use this function.
  • Not suitable for machines where the Z-axis may shift after a power outage.
  • Introduction to KPPM

Configuration

Turn off power-off shutdown

Note
  • To use the power failure resume function, you need to turn off the power-off shutdown.
  • The power failure resume has an automatic shutdown function after saving the progress.
  • Please make sure there is no other power connected to the host, otherwise it will not be able to 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 figure, uncheck -> filter hidden files and folders.
    • For mainsail, as shown on the right in the figure, 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
  • Replace the : (PINS) in the configuration file with host:gpiochip1/gpio21
  • In the printer configuration page, find the plr.cfg file.
  • Empty its content, then paste the configuration below
  • Configuration file content is as follows:
[mcu host]   
serial: /tmp/klipper_host_mcu

[power_loss_resume]
power_pin: (PINS)
is_shutdown: True # Whether to execute the shutdown operation, enabled by default
paused_recover_z: -2.0 # Z movement distance when resuming printing if paused, default is no movement
start_gcode:
# Gcode executed before resuming printing
# All parameters saved before power failure 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 reach set temperature
G91 ; Relative coordinates
G1 Z2 F100 ; Raise Z, prepare to zero X,Y
G90 ; Absolute coordinates
G28 X Y ; Zero 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 reach set temperature
M109 S{PLR.extruder.target} ; Wait for extruder to reach 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 executed before shutdown
M118 Low power voltage, shutting down
# M112 ; Emergency stop

Note
  • The start_gcode macro in the above configuration file may need to be modified, specific modifications should be based on the actual machine.
  • If you are using [homing_override], do not arbitrarily set the homing position in [homing_override]. The failure of power failure resume is not responsible.
  • If you are using [gcode_macro _CLIENT_VARIABLE], find variable_custom_park_dz and set it to 0
  • After saving the configuration file above

  • 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 failure resume function has been configured.

Test

  • Print any file, click the Emergency Stop button during printing to simulate a power failure.
  • 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 failure resume function is working properly.
  • Subsequently, you can continue to test real power failure situations.
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 -