Skip to main content

Power-off Shutdown and Power-off Resume Printing

Note
  • The power-off shutdown and power-off resume printing functions conflict with each other and cannot be enabled simultaneously
  • If only the power-off shutdown function is enabled, the power-off resume printing function will not be available
  • The Klipper connection must be properly configured and maintained for the power-off resume printing function to take effect. Once this function is triggered, the system will automatically enter the shutdown process

Configuration

Disable Power Failure Shutdown

Note
  • The power failure shutdown function needs to be disabled, otherwise the power failure resume printing function cannot be used.
  • The power failure resume printing function includes an automatic shutdown feature after saving progress.
  • Please ensure that no other power supply is connected to the host computer, otherwise it will not be able to power on.
  • 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 -> "Filter hidden files and folders" as shown on the left in the image below.
    • In Mainsail, check -> "Show hidden files" as shown on the right in the image below.
    • You will now see the .flyos-config folder. Inside this folder is the sys-config.conf file.
    • The sys-config.conf file is a symbolic link to the config.txt configuration file in the removable disk FlyOS-Conf.
    • Open the sys-config.conf file and locate the configurations shutdown_pin_state and shutdown_pin=.
    • Add a # at the beginning of these configuration lines.
    • Then click Save -> Close and restart the device.

plr.cfg Configuration File

  • In the printer configuration page, locate the plr.cfg file.
  • Clear its contents and paste the configuration below.
  • The contents of the configuration file are as follows:
  • Use the code below if you are using version C5.
[mcu host]   
serial: /tmp/klipper_host_mcu

[power_loss_resume]
power_pin: !host:gpiochip0/gpio260
is_shutdown: True # Whether to perform a shutdown operation; default is enabled.
paused_recover_z: -2.0 # If paused during shutdown, Z-axis movement distance when resuming; default is no movement.
start_gcode:
# G-code executed before resuming print
# All parameters saved before power loss can be accessed via {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 home X and Y
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 # Execute layer_change_gcode after resuming print for specified number of layers
layer_change_gcode:
# G-code executed after resuming print for {layer_count} layers
M118 Resume print speed
M106 S{PLR.fan_speed} ; Enable part 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:
# G-code executed before shutdown
M118 Low power voltage, shutting down
# M112 ; Emergency stop
  • After saving the above configuration file,

  • Open the printer.cfg file and add the following content at the very beginning:


    [include plr.cfg]

  • Click save and restart from the top right corner.

  • At this point, the power loss resume feature of Klipper has been configured.

Description of [homing_override]

Note
  • If [homing_override] is used, do not arbitrarily set the homing position in [homing_override]. Any failure in power loss resume caused by this will not be covered.
  • The configuration instructions for [homing_override] are provided below.
  • Description
    • [force_move]: Enables the force move function, allowing forced movement to a specified position.
    • [force_move] replaces the set_position_z function in [homing_override]. Failure to configure this may result in power loss resume failure.
    • The [homing_override] configuration below 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 %}

  • Description of raising Z-axis
    • This configuration is executed only when the Z-axis is not homed; it does not affect normal operation.
  {% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}

Testing

  • Print any file, click the Emergency Stop button during printing to simulate power loss.
  • Click Firmware Restart again and wait for Klipper to reconnect normally.
  • If a pop-up notification appears on the web interface or KlipperScreen, the power loss resume function is working correctly.
  • Further tests under real power loss conditions can be conducted.
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 -
Loading...