Skip to main content

Power Loss Shutdown and Power Loss Resume

Important Notes
  • Power Loss Shutdown and Power Loss Resume functions conflict with each other and cannot be enabled simultaneously
  • If only the Power Loss Shutdown function is enabled, the Power Loss Resume function will not be available
  • Klipper must be correctly configured and connected for the Power Loss Resume function to work. Once triggered, it will automatically initiate the shutdown process

Feature Configuration

Disable Power Loss Shutdown

Note
  • Power Loss Shutdown must be disabled, otherwise the Power Loss Resume function cannot be used
  • Power Loss Resume has an automatic shutdown function after saving progress
  • Ensure no other power source is connected to the upper computer, otherwise normal shutdown will not be possible
  1. Access the device configuration page

    • Enter the device IP address in the browser address bar, e.g., http://192.168.1.2/
  2. Show hidden files

    • Fluidd: Uncheck "Filter hidden files and folders"
    • Mainsail: Check "Show hidden files"
    Loading...
    Loading...
  3. Edit the configuration file

    • Find and enter the .flyos-config folder
    • Open the sys-config.conf file
Loading...
  1. Comment out Power Loss Shutdown configuration

    • Find the shutdown_pin_state and shutdown_pin configuration items
    • Add # in front of these two configurations to comment them out
  2. Save and reboot

    • Save the modified configuration file
    • Close the file and reboot the system
Loading...

Configuring Power Loss Resume

  1. Edit the plr.cfg configuration file

    • In the printer configuration page, find or create the plr.cfg file
    • Clear the file content and paste the following configuration:
    • Please modify the power_pin parameter according to the actual GPIO number used
    [mcu host]
    serial: /tmp/klipper_host_mcu

    [power_loss_resume]
    power_pin: xxxx
    is_shutdown: True # Whether to execute shutdown operation, enabled by default
    paused_recover_z: -2.0 # Z movement distance when resuming if paused during print stop, default is no movement
    start_gcode:
    # gcode to execute before starting resume
    # All parameters saved before power loss can be obtained via {PLR}
    # Use M118 {PLR} to output all available parameters
    # M118 {PLR}
    M118 Starting Resume: {PLR.print_stats.filename}
    M118 Interrupted Position: X:[{PLR.POS_X}] Y:[{PLR.POS_Y}] Z:[{PLR.POS_Z}] E:[{PLR.POS_E}]
    {% if PLR.bed.target > 0 %}
    M140 S{PLR.bed.target} ; Set bed temperature
    {% endif %}
    {% if PLR.extruder.target > 50 %}
    M104 S{PLR.extruder.target - 10} ; Wait for extruder to heat to target temperature
    {% endif %}
    G91 ; Relative positioning
    G1 Z2 F100 ; Raise Z, prepare X,Y homing
    G90 ; Absolute positioning
    G28 X Y ; Home XY
    {% if PLR.bed.target > 0 %}
    M190 S{PLR.bed.target} ; Wait for bed to reach target temperature
    {% endif %}
    {% if PLR.extruder.target > 0 %}
    M109 S{PLR.extruder.target} ; Wait for extruder to reach target temperature
    {% endif %}
    M83 ; Relative extrusion
    # G1 E0.5 F400 ; Extrude a little
    layer_count: 2 # Execute layer_change_gcode after resuming for the specified number of layers
    layer_change_gcode:
    # gcode to execute after resuming for {layer_count} layers
    M118 Resuming print speed
    M106 S{PLR.fan_speed} ; Turn on 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:
    # gcode to execute before shutdown
    M118 Power supply voltage low, shutting down
    # M112 ; Emergency stop
  2. Include the configuration file

    • Open the printer.cfg file, and add the following at the very beginning:
    [include plr.cfg]
    • Click Save and Restart in the top right corner

Configuring Homing Override

Important Notes
  • If using [homing_override], do not arbitrarily set homing positions in the configuration
  • Incorrect configuration may cause Power Loss Resume to fail

Configuration Explanation

  • [force_move]: Enables the force move function, allowing forced movement to specified positions
  • [force_move] replaces the set_position_z function in [homing_override]
  • The following configuration ensures correct Z-axis homing 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 %}

Explanation of Z-axis Lift This configuration only executes when the Z-axis is not homed, and does not affect normal use:

{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}

Function Testing

Step 1: Simulated Power Loss Test

  1. Start printing any file
  2. During printing, click the Emergency Stop button to simulate a power loss situation
  3. Click Firmware Restart and wait for Klipper to reconnect
  4. Observe if a popup notification appears on the web interface (if it appears, the function is working)
  5. Afterwards, proceed with an actual power loss test to verify reliability

Step 2: Actual Power Loss Test

  1. Test Preparation: Check the status of the indicator light next to the upper computer (LED should be blinking during normal operation)
  2. Power Loss Test: Disconnect the power supply directly while the device is running normally
  3. Indicator Light Check: Observe if the indicator light completely turns off within 5 seconds
    • Turns off: Power Loss Shutdown function is working
    • Does not turn off: Auto shutdown function has not taken effect, check configuration
  4. Recovery Test: Wait at least 5 seconds, then reconnect the power supply
  5. Function Verification:
    • Popup appears: Power Loss Resume function is working
    • No prompt: Power Loss Resume function has not started, check configuration

Loading...