Power Off Shutdown and Power Loss Resume
Important Notes
- Power Off Shutdown and Power Loss Resume functions conflict with each other and cannot be enabled simultaneously
- If only the power off shutdown function is enabled, the power loss resume function will be unavailable
- Klipper connection must be correctly configured and maintained for the power loss resume function to take effect. Once triggered, it will automatically enter the shutdown process
Function Configuration
- Power Off Shutdown
- Power Loss Resume
Configuring Power Off Shutdown
Notice
Follow the steps below to configure the power off 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.,
-
Display hidden files
- Fluidd: Uncheck "Filter hidden files and folders"
- Mainsail: Check "Show hidden files"
Loading...Loading... -
Edit configuration files
- Find and enter the
.flyos-configfolder - Open the
sys-config.conffile (this file is a soft link toconfig.txtin theFlyOS-Confdisk)
Loading... - Find and enter the
-
Modify configuration parameters
- Find the
shutdown_pin_stateandshutdown_pinconfiguration items - Modify them to the following configuration:
shutdown_pin_state=1shutdown_pin=xxxxx- Ensure
shutdown_pin=nonehas been deleted or commented out (add#in front) - Where
xxxxxis the actual GPIO number used, select the correct GPIO based on your device model:
- Find the
-
Save and restart
- Save the modified configuration file
- Close the file and restart the system
Loading...
Disable Power Off Shutdown Function
Notice
- Power off shutdown must be disabled, otherwise the power loss resume function cannot be used
- Power loss resume includes an automatic shutdown function after saving progress
- Ensure no other power is connected to the host, otherwise normal shutdown may 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.,
-
Display hidden files
- Fluidd: Uncheck "Filter hidden files and folders"
- Mainsail: Check "Show hidden files"
Loading...Loading... -
Edit configuration files
- Find and enter the
.flyos-configfolder - Open the
sys-config.conffile
- Find and enter the
Loading...
-
Comment out power off shutdown configuration
- Find the
shutdown_pin_stateandshutdown_pinconfiguration items - Add
#in front of these two configurations to comment them out
- Find the
-
Save and restart
- Save the modified configuration file
- Close the file and restart the system
Loading...
Configure Power Loss Resume Function
-
Edit the
plr.cfgconfiguration file- On 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 in use
[mcu host]serial: /tmp/klipper_host_mcu[power_loss_resume]power_pin: xxxxis_shutdown: True # Whether to perform shutdown, enabled by defaultpaused_recover_z: -2.0 # Z movement distance when resuming from a paused print; default is no movementstart_gcode:# Gcode to execute before starting resume# All saved parameters before power loss can be accessed 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 nozzle to heat to set temperature{% endif %}G91 ; Relative positioningG1 Z2 F100 ; Raise Z, prepare for X,Y homingG90 ; Absolute positioningG28 X Y ; Home X and Y{% 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 nozzle to reach target temperature{% endif %}M83 ; Relative extrusion# G1 E0.5 F400 ; Extrude a littlelayer_count: 2 # Execute layer_change_gcode after this many layers are resumedlayer_change_gcode:# Gcode to execute after {layer_count} layers have been resumedM118 Resume 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 Low power voltage, shutting down# M112 ; Emergency stop - On 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 the save button in the top right corner and restart
- Open the
Configure Homing Override
Important Notes
- If using
[homing_override], do not arbitrarily set homing positions in the configuration - Incorrect configuration may cause power loss resume failure
Configuration Explanation
[force_move]: Enables the force move function, allowing forced movement to specified positions[force_move]replaces theset_position_zfunctionality 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 %}
About Z-Axis Lift Explanation This configuration only executes when the Z-axis has not been 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
- Click Firmware Restart, wait for Klipper to reconnect
- Observe if a popup appears on the web interface (a popup indicates the function is working normally)
- Proceed with a real power loss test to verify function reliability
Step 2: Real Power Loss Test
- Test Preparation: Confirm the status of the indicator light next to the host (LED should be flashing during normal operation)
- Power Loss Test: Disconnect power directly while the device is running normally
- Indicator Light Check: Observe if the indicator light completely turns off within 5 seconds
- Turns off: Power off shutdown function is working normally
- Does not turn off: Automatic shutdown function is not effective, check the configuration
- Recovery Test: Wait at least 5 seconds before reconnecting power
- Function Verification:
- Popup appears: Power loss resume function is working normally
- No prompt: Power loss resume function did not start, check the configuration
Loading...