Power-off Shutdown and Power-loss Resumption
Note
- Fly_FAST system is required; other systems are not supported!
- Power-off shutdown and power-loss resumption functions conflict with each other and cannot be enabled simultaneously.
- If only the power-off shutdown function is enabled, the power-loss resumption function will be unavailable.
- Klipper must be configured correctly and remain connected for the power-loss resumption function to take effect. After this function is triggered, the system will automatically enter the shutdown process.
Wiring
Important Notes
- Notes on FLY Pi-V2 power-off shutdown/resumption function
- When connecting other host computers via USB, the 5V power cable must be disconnected or isolated (e.g., by cutting the wire or using a USB cable with only data pins).
- Power must be supplied using the dedicated KPPM module; do not use other power supply methods.
- If the 5V connection between the microcontroller and the host computer cannot be disconnected, the main board must be completely powered off before restarting, otherwise it may fail to boot properly.
- FLY-Pi-V2 Using 5V wiring
- FLY-Pi-V2 Using USB wiring
- FLY-Pi-V2 using 5V wiring
- FLY-Pi-V2 using USB wiring
Configuration
- Power-off Shutdown
- Power-loss Resumption
Configure Power Failure Shutdown
Note
- Method to configure power failure shutdown
-
Enter the device's IP address in the browser address bar, for example:
http://192.168.6.179
-
Access the configuration page
- Open the device IP address in the browser, for example:
http://192.168.1.2/
- In Fluidd, uncheck the option ->
Filter hidden files and folders
as shown in the left image below. - In Mainsail, check the option ->
Show hidden files
as shown in the right image below.
- You should now see the
.flyos-config
folder. Enter this folder and locate thesys-config.conf
file. - The
sys-config.conf
file is a symbolic link to theconfig.txt
configuration file in the removable disk namedFlyOS-Conf
.
- Open the
sys-config.conf
file and locate the two configurationsshutdown_pin_state
andshutdown_pin=
, and modify them to match the configurations below: - Please note that
shutdown_pin=none
needs to be deleted or preceded by a#
symbol.
- Open the device IP address in the browser, for example:
shutdown_pin_state=1
shutdown_pin=PA21
- Then
Save
->Close
and restart the system.

Disable Power Failure Shutdown
Note
- The power failure shutdown function needs to be disabled, otherwise the power failure resume printing function cannot be used.
- The power failure resume printing function includes an automatic shutdown feature after saving progress.
- Please ensure that no other power supply is connected to the host computer, otherwise it will not be able to power on.
-
Enter the device's IP address in the browser's address bar, for example:
http://192.168.6.179
-
Access the configuration page
- Open the device IP address in the browser, for example:
http://192.168.1.2/
- In Fluidd, uncheck -> "Filter hidden files and folders" as shown on the left in the image below.
- In Mainsail, check -> "Show hidden files" as shown on the right in the image below.
- You will now see the
.flyos-config
folder. Inside this folder is thesys-config.conf
file. - The
sys-config.conf
file is a symbolic link to theconfig.txt
configuration file in the removable diskFlyOS-Conf
.
- Open the
sys-config.conf
file and locate the configurationsshutdown_pin_state
andshutdown_pin=
. - Add a
#
at the beginning of these configuration lines. - Then click
Save
->Close
and restart the device.
- Open the device IP address in the browser, for example:
plr.cfg Configuration File
- In the printer configuration page, locate the
plr.cfg
file. - Clear its contents and paste the configuration below.
- The configuration file content is as follows:
[mcu host]
serial: /tmp/klipper_host_mcu
[power_loss_resume]
power_pin: host:gpiochip1/gpio21
is_shutdown: True # Whether to execute shutdown operation, enabled by default
paused_recover_z: -2.0 # If printing was paused when powered off, the Z-axis movement distance during resume, default is no movement
start_gcode:
# G-code executed before resuming print
# All parameters saved before power loss can be accessed via {PLR}
# M118 {PLR} can be used to output all available parameters
M118 Resume printing: {PLR.print_stats.filename}
M118 Pause position: X:[{PLR.POS_X}] Y:[{PLR.POS_Y}] Z:[{PLR.POS_Z}] E:[{PLR.POS_E}]
M140 S{PLR.bed.target} ; Set bed temperature
M104 S{PLR.extruder.target-10} ; Set extruder temperature
M109 S{PLR.extruder.target-10} ; Wait for extruder to reach the set temperature
G91 ; Relative coordinates
G1 Z2 F100 ; Raise Z-axis, prepare for X and Y homing
G90 ; Absolute coordinates
G28 X Y ; Home X and Y axes
M140 S{PLR.bed.target} ; Set bed temperature
M104 S{PLR.extruder.target} ; Set extruder temperature
M190 S{PLR.bed.target} ; Wait for bed to reach the set temperature
M109 S{PLR.extruder.target} ; Wait for extruder to reach the set temperature
M83 ; Relative extrusion
# G1 E0.5 F400 ; Extrude a little
layer_count: 2 # Execute layer_change_gcode after resuming for {layer_count} layers
layer_change_gcode:
# G-code to execute after resuming for {layer_count} layers
M118 Resume print speed
M106 S{PLR.fan_speed} ; Enable 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 executed before shutdown
M118 Low power voltage, shutting down
# M112 ; Emergency stop
-
After saving the configuration file above,
-
Open the
printer.cfg
file and add the following content at the very beginning:
[include plr.cfg] -
Click Save and Restart in the upper right corner to complete the process.
-
By now, the power loss resume feature of Klipper has been configured.
Description of [homing_override]
Note
- When using
[homing_override]
, do not arbitrarily set the homing position within it. Any failure of resuming print after power loss caused by this will not be covered. - Configuration description for
[homing_override]
is provided below.
- Description
[force_move]
: Enables the force move feature, allowing forced movement to a specified position.[force_move]
replaces theset_position_z
functionality in[homing_override]
. If the configuration is not followed accordingly, it may result in failure when resuming printing after power loss.- The
[homing_override]
configuration below ensures that the Z-axis can correctly home when resuming printing after power loss.
[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 %}
- Description of lifting
- This configuration is executed only when the Z-axis is not homed. It does not affect normal operations.
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}
- This configuration is executed only when the Z-axis is not homed. It does not affect normal operations.
Test
First Test: Simulate Power Loss via Emergency Shutdown
- Start printing any file. During printing, click the Emergency Stop button to simulate a power loss situation.
- Click Firmware Restart again, and wait for
Klipper
to reconnect and return to normal operation. - Check if a pop-up appears on the web interface. If a prompt is shown, the power-loss recovery printing function is working properly.
- Further testing under actual power loss conditions can be conducted to verify the reliability of the function.
Second Test: Simulate Real Power Loss and Verify Functionality
- Test Preparation: After the system starts normally and connects to
Klipper
, confirm the status of the indicator light next to the host computer. Usually, there will be anLED
flashing while the system is running, which is the key indicator to observe in the following steps. - While the device is running normally and connected to
Klipper
, directly disconnect the power to simulate a real power loss scenario. - Immediately check whether the indicator light next to the host computer completely turns off within 5 seconds.
- If it turns off: This indicates the power-off shutdown function is working properly. Please proceed to the next steps.
- If it does not turn off: This suggests the automatic shutdown function is not active. Usually, this is caused by incorrect configuration (e.g., wiring or configuration of
kppm
). Thorough inspection and troubleshooting are required.
- Wait for at least
5
seconds, then reconnect the power and observe whetherKlipper
can automatically reconnect and resume normal operation. (It takes 3-5 seconds to save data and shut down.) - Check the web interface:
- If a pop-up prompt appears: This indicates the power-loss recovery printing function has been successfully activated and is functioning normally.
- If no prompt appears: This indicates the power-loss recovery printing function did not start as expected. Please systematically check the relevant configuration based on the above phenomena.
Loading...