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
- Power Loss Shutdown
- Power Loss Resume
Configuring Power Loss Shutdown
Note
Please follow the steps below to configure the Power Loss Shutdown function
-
Access the device configuration page
- Enter the device IP address in the browser address bar, e.g.,
http://192.168.1.2/
- Enter the device IP address in the browser address bar, e.g.,
-
Show hidden files
- Fluidd: Uncheck "Filter hidden files and folders"
- Mainsail: Check "Show hidden files"
Loading...Loading... -
Edit the configuration file
- Find and enter the
.flyos-configfolder - Open the
sys-config.conffile (This file is a symlink toconfig.txtin theFlyOS-Confdisk)
Loading... - Find and enter the
-
Modify configuration parameters
- Find the
shutdown_pin_stateandshutdown_pinconfiguration items - Change to the following configuration:
shutdown_pin_state=1shutdown_pin=xxxxx- Ensure that
shutdown_pin=noneis deleted or commented out (add#in front) - Where
xxxxxis the actual GPIO number used. Please select the correct GPIO based on your device model:
- Find the
-
Save and reboot
- Save the modified configuration file
- Close the file and reboot the system
Loading...
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
-
Access the device configuration page
- Enter the device IP address in the browser address bar, e.g.,
http://192.168.1.2/
- Enter the device IP address in the browser address bar, e.g.,
-
Show hidden files
- Fluidd: Uncheck "Filter hidden files and folders"
- Mainsail: Check "Show hidden files"
Loading...Loading... -
Edit the configuration file
- Find and enter the
.flyos-configfolder - Open the
sys-config.conffile
- Find and enter the
Loading...
-
Comment out Power Loss Shutdown configuration
- Find the
shutdown_pin_stateandshutdown_pinconfiguration items - Add
#in front of these two configurations to comment them out
- Find the
-
Save and reboot
- Save the modified configuration file
- Close the file and reboot the system
Loading...
Configuring Power Loss Resume
-
Edit the plr.cfg configuration file
- In the printer configuration page, find or create the
plr.cfgfile - Clear the file content and paste the following configuration:
- Please modify the
power_pinparameter according to the actual GPIO number used
[mcu host]serial: /tmp/klipper_host_mcu[power_loss_resume]power_pin: xxxxis_shutdown: True # Whether to execute shutdown operation, enabled by defaultpaused_recover_z: -2.0 # Z movement distance when resuming if paused during print stop, default is no movementstart_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 positioningG1 Z2 F100 ; Raise Z, prepare X,Y homingG90 ; Absolute positioningG28 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 littlelayer_count: 2 # Execute layer_change_gcode after resuming for the specified number of layerslayer_change_gcode:# gcode to execute after resuming for {layer_count} layersM118 Resuming print speedM106 S{PLR.fan_speed} ; Turn on part cooling fanM220 S{PLR.move_speed_percent} ; Set requested speed percentageM221 S{PLR.extrude_speed_percent} ; Set requested extrusion speed percentageshutdown_gcode:# gcode to execute before shutdownM118 Power supply voltage low, shutting down# M112 ; Emergency stop - In the printer configuration page, find or create the
-
Include the configuration file
- Open the
printer.cfgfile, and add the following at the very beginning:
[include plr.cfg]- Click Save and Restart in the top right corner
- Open the
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 theset_position_zfunction 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
- Start printing any file
- During printing, click the Emergency Stop button to simulate a power loss situation
- Click Firmware Restart and wait for Klipper to reconnect
- Observe if a popup notification appears on the web interface (if it appears, the function is working)
- Afterwards, proceed with an actual power loss test to verify reliability
Step 2: Actual Power Loss Test
- Test Preparation: Check the status of the indicator light next to the upper computer (LED should be blinking during normal operation)
- Power Loss Test: Disconnect the power supply directly while the device is running normally
- 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
- Recovery Test: Wait at least 5 seconds, then reconnect the power supply
- Function Verification:
- Popup appears: Power Loss Resume function is working
- No prompt: Power Loss Resume function has not started, check configuration
Loading...