Power-Off Shutdown and Power-Loss Resume
Important Notes
- Power-off shutdown and power-loss resume functionalities are mutually exclusive and cannot be enabled simultaneously.
- If only power-off shutdown is enabled, the power-loss resume function cannot be used.
- Power-loss resume requires Klipper to maintain a normal connection. Once the function is triggered, the system will automatically enter the shutdown process.
Function Configuration
- Power-Off Shutdown
- Power-Loss Resume
Configuring Power-Off Shutdown
Accessing Device Configuration
- Enter the device IP address in the browser address bar, for example,
http://<device_ip>/. - Show hidden files.
- Fluidd: Uncheck "Filter hidden files and folders".
- Mainsail: Check "Show hidden files".
Fluidd hidden file settings:
Loading...
Mainsail hidden file settings:
Loading...
Modifying Configuration File
- Locate and enter the
.flyos-configfolder. - Open the
sys-config.conffile. This file is a symbolic link toconfig.txtin theFlyOS-Confdisk.
Loading...
- Find 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 Resume
Disabling Power-Off Shutdown
Note
- 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.
- Please confirm that no other power source is connected to the host computer; otherwise, normal shutdown may not be possible.
- Enter the device IP address in the browser address bar, for example,
http://<device_ip>/. - Show hidden files.
- Fluidd: Uncheck "Filter hidden files and folders".
- Mainsail: Check "Show hidden files".
- 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 Resume Configuration
- On the printer configuration page, find or create the
plr.cfgfile. - Clear the file content and paste the following configuration.
- Modify the
power_pinparameter according to the actual device. Must use the host computer GPIO or the pin recommended by the product, cannot use the lower computer (MCU/tool board) pins.
[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:
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}]
{% for name, heater in PLR.heaters.items() %}
{% if heater.target > 0 %}
M118 Setting heater[{heater.name}] target temperature: {heater.target}
SET_HEATER_TEMPERATURE HEATER="{heater.name}" TARGET={heater.target}
{% endif %}
{% endfor %}
{% if PLR.toolhead.extruder in PLR.heaters and PLR.heaters[PLR.toolhead.extruder].target > 0 %}
{% set extruder = PLR.heaters[PLR.toolhead.extruder] %}
M118 Waiting for[{extruder.name}] to reach target temperature: {extruder.target}
TEMPERATURE_WAIT SENSOR="{extruder.name}" MINIMUM={extruder.target-5} MAXIMUM={extruder.target+5}
{% endif %}
G91 ; Relative coordinates
G1 Z2 F100 ; Raise Z, prepare X,Y homing
G90 ; Absolute coordinates
G28 X ; Home X
G28 Y ; Home Y
M83 ; Relative extrusion
# G1 E0.5 F400 ; Extrude a little
layer_count: 2
layer_change_gcode:
M118 Restoring print speed
M106 S{PLR.fan_speed}
M220 S{PLR.move_speed_percent}
M221 S{PLR.extrude_speed_percent}
shutdown_gcode:
M118 Low power voltage, shutting down
# M112
Including Configuration File
Open the printer.cfg file and add at the very beginning:
[include plr.cfg]
Save and restart Klipper.
Configuring Homing Override
Important Considerations
- If using
[homing_override], do not set homing positions arbitrarily in the configuration. - Incorrect configuration may cause power-loss resume 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 %}
Function Testing
Simulated Power Loss Test
- Start printing any file.
- Click the Emergency Stop button during printing to simulate a power loss.
- Click Firmware Restart and wait for Klipper to reconnect.
- Observe if a pop-up prompt appears on the web interface.
- Subsequently, a real power loss test can be performed to verify function reliability.
Real Power Loss Test
- Confirm the status of the indicator light next to the host computer; the LED should be flashing during normal operation.
- Directly disconnect the power while the device is running normally.
- Observe if the indicator light completely turns off within 5 seconds.
- Wait at least 5 seconds before reconnecting the power.
- If a resume pop-up appears, the power-loss resume function is working correctly.
Loading...