Skip to main content

Power Off Shutdown and Power Loss Resume

Important Notice
  • Power Off Shutdown and Power Loss Resume features are mutually exclusive and cannot be enabled simultaneously
  • If only the power-off shutdown function is enabled, the power loss resume function will be unavailable
  • Klipper must be properly configured and connected for the power loss resume function to work. Once triggered, this function will automatically initiate the shutdown process

Feature Configuration

Disable Power Off Shutdown Function

Notice
  • The power-off shutdown function must be disabled, otherwise the power loss resume function will not work
  • The power loss resume function includes the ability to automatically shut down after saving progress
  • Please ensure no other power is connected to the host, otherwise normal shutdown will not occur
  1. Access the device configuration page

    • Enter the device IP address in the browser address bar, for example: http://192.168.1.2/
  2. Display hidden files

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

    • Locate and enter the .flyos-config folder
    • Open the sys-config.conf file
  1. Comment out power-off shutdown configuration

    • Locate the shutdown_pin_state and shutdown_pin configuration entries
    • Add # in front of these two configurations to comment them out
  2. Save and restart

    • Save the modified configuration file
    • Close the file and restart the system

Configure Power Loss Resume Function

  1. Edit the plr.cfg configuration file

    • On 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, default is enabled
    paused_recover_z: -2.0 # If the print is paused when powered off, this is the Z-axis movement distance for resuming, default is no movement
    start_gcode:
    # G-code to execute before resuming printing
    # All parameters saved before power loss can be retrieved via {PLR}
    # You can use M118 {PLR} to output all available parameters
    # M118 {PLR}
    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}]
    {% 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 set temperature
    {% endif %}
    G91 ; Relative coordinates
    G1 Z2 F100 ; Lift Z, prepare for X,Y homing
    G90 ; Absolute coordinates
    G28 X Y ; Home XY
    {% if PLR.bed.target > 0 %}
    M190 S{PLR.bed.target} ; Wait for bed to heat to set temperature
    {% endif %}
    {% if PLR.extruder.target > 0 %}
    M109 S{PLR.extruder.target} ; Wait for extruder to heat to set temperature
    {% endif %}
    M83 ; Relative extrusion
    # G1 E0.5 F400 ; Extrude a bit
    layer_count: 2 # Execute layer_change_gcode after resuming for {layer_count} layers
    layer_change_gcode:
    # G-code to execute after resuming for {layer_count} layers
    M118 Resume print speed
    M106 S{PLR.fan_speed} ; Turn on part cooling fan
    M220 S{PLR.move_speed_percent} ; Set requested move speed percentage
    M221 S{PLR.extrude_speed_percent} ; Set requested extrusion speed percentage
    shutdown_gcode:
    # G-code to execute before shutdown
    M118 Low power voltage, shutting down
    # M112 ; Emergency stop
  2. Include configuration file

    • Open the printer.cfg file and add the following at the beginning:
    [include plr.cfg]
    • Click save and restart

Configure Homing Override

Important Notes
  • If using [homing_override], do not arbitrarily set homing positions in the configuration
  • Incorrect configuration may cause the power loss resume function to fail

Configuration Description

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

Z-axis lift description This configuration only executes when the Z-axis has not been homed and does not affect normal operation:

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

Function Test

Step 1: Simulate Power Loss Test

  1. Start printing any file
  2. During the print, click the Emergency Stop button to simulate a power loss situation
  3. Click Firmware Restart and wait for Klipper to reconnect
  4. Check if a pop-up appears on the web interface (a pop-up indicates the function is working correctly)
  5. A real power loss test can be performed later to verify the reliability of the function

Step 2: Real Power Loss Test

  1. Test preparation: Confirm the status of the indicator light next to the host (the LED should be blinking during normal operation)
  2. Power loss test: Directly disconnect the power while the device is operating normally
  3. Check indicator light: Observe whether the indicator light completely turns off within 5 seconds
    • Turns off: The power-off shutdown function is working correctly
    • Does not turn off: The automatic shutdown function is not effective, check the configuration
  4. Recovery test: Wait at least 5 seconds before reconnecting the power
  5. Function verification:
    • Pop-up appears: The power loss resume function is working correctly
    • No prompt: The power loss resume function is not activated, check the configuration

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...