Power-Off Shutdown and Power-Loss Resume Printing
Important Notes
- Power-Off Shutdown and Power-Loss Resume Printing are mutually exclusive and cannot be enabled simultaneously.
- If only the Power-Off Shutdown function is enabled, the Power-Loss Resume Printing function cannot be used.
- Power-Loss Resume Printing requires Klipper to maintain a normal connection. After the function is triggered, the system will automatically enter the shutdown process.
Feature Configuration
- Power-Off Shutdown
- Power-loss Resume Printing
Configure Power-off Shutdown
Enter Device Configuration
- Enter the device IP address in the browser address bar, for example
http://<device_ip>/. - Show hidden files.
- Fluidd: Check "Show hidden files".
- Mainsail: Uncheck "Filter hidden files and folders".
Fluidd Hidden file settings:
Loading...
Mainsail Hidden file settings:
Loading...
Modify Configuration File
- Locate and enter the
.flyos-configfolder. - Open the
sys-config.conffile. This file is a soft link toconfig.txtin theFlyOS-Confdisk.
Loading...
- Locate the
shutdown_pin_stateandshutdown_pinconfiguration items, and modify them to:
shutdown_pin_state=1
shutdown_pin=<shutdown_gpio>
- Ensure that
shutdown_pin=nonehas been deleted or commented out. - Save the modified configuration file and restart the system.
Loading...
Configuring Power Loss Recovery
Disabling Power-Off Shutdown
Notice
- Power-off shutdown must be disabled; otherwise, the power loss recovery function cannot be used.
- Power loss recovery includes an automatic shutdown function after saving progress.
- Please confirm that no other power supply is connected to the host, otherwise it may not shut down properly.
- Enter the device IP address in the browser address bar, for example
http://<device_ip>/. - Show hidden files.
- Fluidd: Check "Show hidden files".
- Mainsail: Uncheck "Filter hidden files and folders".
- Enter the
.flyos-configfolder and open thesys-config.conffile. - Find the
shutdown_pin_stateandshutdown_pinconfiguration items, and add#in front of these two configurations to comment them out. - Save the modified configuration file and restart the system.
Loading...
Adding Power Loss Recovery Configuration
- In the printer configuration page, find or create the
plr.cfgfile. - Clear the file contents and paste the following configuration.
- Modify the
power_pinparameter according to the actual device. You must use the host GPIO or the pin recommended by the product; do not use pins on the lower-level board (MCU/tool board).
[mcu host]
serial: /tmp/klipper_host_mcu
[power_loss_resume]
power_pin: <power_loss_pin>
is_shutdown: True
paused_recover_z: -2.0
start_gcode:
# G-code to execute before starting recovery printing
# All parameters saved before power loss can be obtained through {PLR}
# You can use M118 {PLR} to output all available parameters
# M118 {PLR}
M118 Start recovery printing: {PLR.print_stats.filename}
M118 Interruption position: X:[{PLR.POS_X}] Y:[{PLR.POS_Y}] Z:[{PLR.POS_Z}] E:[{PLR.POS_E}]
# Restore all heater temperatures
{% for name, heater in PLR.heaters.items() %}
{% if heater.target > 0 %}
M118 Set heater[{heater.name}] target temperature: {heater.target}
SET_HEATER_TEMPERATURE HEATER="{heater.name}" TARGET={heater.target}
{% endif %}
{% endfor %}
# Wait for extrusion temperature
{% if PLR.toolhead.extruder in PLR.heaters and PLR.heaters[PLR.toolhead.extruder].target > 0 %}
{% set extruder = PLR.heaters[PLR.toolhead.extruder] %}
M118 Wait for [{extruder.name}] to reach target temperature: {extruder.target}
TEMPERATURE_WAIT SENSOR="{extruder.name}" MINIMUM={extruder.target-5} MAXIMUM={extruder.target+5}
{% endif %}
M83 ; Relative extrusion
G1 E-2 F1000 ; Retract
G91 ; Relative coordinates
G1 Z2 F100 ; Raise Z, prepare for X,Y homing
G90 ; Absolute coordinates
G28 X Y ; Home XY
resume_gcode:
# G-code to execute after moving to the target position and before starting formal printing
M83 ; Relative extrusion
G1 E4 F800 ; Extrude 4mm filament, oozing compensation
layer_count: 2 # Execute layer_change_gcode after resuming printing for the specified number of layers
layer_change_gcode:
# G-code to execute after resuming printing for {layer_count} layers
M118 Restore printing 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:
# G-code to execute before shutdown
M118 Power voltage low, shutting down
# M112 ; Emergency stop
Including the Configuration File
Open the printer.cfg file and add the following at the very beginning of the file:
[include plr.cfg]
Save and restart Klipper.
Configuring Homing Override
Important Notes
- If using
[homing_override], do not arbitrarily set homing positions in the configuration. - Incorrect configuration may cause power loss recovery to fail.
[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 %}
Functional Testing
Simulated Power-Loss Test
- Start printing any file.
- During printing, click the Emergency Stop button to simulate a power loss condition.
- Click Firmware Restart and wait for Klipper to reconnect.
- Observe whether a popup prompt appears on the web interface.
- Subsequently, a real power-loss test can be performed to verify the reliability of the function.
Real Power-Off Test
- Confirm the status of the indicator light next to the host computer; during normal operation, the LED should be blinking.
- Directly disconnect the power supply while the device is running normally.
- Observe whether the indicator light turns off completely within 5 seconds.
- Wait at least 5 seconds before reconnecting the power supply.
- If a resume-printing pop-up appears, it indicates that the power-off resume printing function is working properly.
Loading...