Power-off Shutdown and Power-loss Resume
Important Notice
- The 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 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
Configure Power-off Shutdown
Enter Device Configuration
- Enter the device IP address in the browser address bar, e.g.,
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...
Modify Configuration File
- Find and enter the
.flyos-configfolder. - Open the
sys-config.conffile. This file is a soft 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...
Configure Power-loss Resume
Disable Power-off Shutdown
Notice
- Power-off shutdown must be disabled, otherwise the power-loss resume function cannot be used.
- Power-loss resume includes the automatic shutdown function after saving progress.
- Ensure no other power supply is connected to the host, otherwise normal shutdown may not be possible.
- Enter the device IP address in the browser address bar, e.g.,
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#at the beginning of these two configurations to comment them out. - Save the modified configuration file and restart the system.
Loading...
Add Power-loss Resume Configuration
- In the printer configuration page, find or create a
plr.cfgfile. - Clear the file content and paste the following configuration.
- Modify the
power_pinparameter according to the actual device. Must use the host GPIO or the pin recommended by the product, do not use the MCU/toolboard 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:
# Gcode executed before starting the resume
# All parameters saved 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}]
# Restore all heater temperatures
{% 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 %}
# Wait for extruder temperature
{% 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 %}
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 X and Y
resume_gcode:
# Gcode executed after moving to the target position and before starting the formal print
M83 ; Relative extrusion
G1 E4 F800 ; Extrude 4mm filament, ooze compensation
layer_count: 2 # Execute layer_change_gcode after resuming the specified number of layers
layer_change_gcode:
# Gcode to execute after resuming {layer_count} layers
M118 Restoring print 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:
# Gcode executed before shutdown
M118 Low power supply voltage, shutting down
# M112 ; Emergency stop
Include Configuration File
Open the printer.cfg file and add the following at the very beginning:
[include plr.cfg]
Save and restart Klipper.
Configure Homing Override
Important Notes
- If using
[homing_override], do not arbitrarily set the homing position 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 the print 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, perform a real power loss test to verify the reliability of the function.
Real Power Loss Test
- Confirm the status of the indicator light next to the host; during normal operation, the LED should flash.
- Disconnect the power supply directly 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 supply.
- If a resume pop-up appears, the power-loss resume function is working normally.
Loading...