Skip to content

Instantly share code, notes, and snippets.

@benlye
Last active May 7, 2026 13:58
Show Gist options
  • Select an option

  • Save benlye/aee202eb5e078dfc24a6c1d37bac5cce to your computer and use it in GitHub Desktop.

Select an option

Save benlye/aee202eb5e078dfc24a6c1d37bac5cce to your computer and use it in GitHub Desktop.
Q1 Pro Klipper Build and Flash
#!/bin/bash
set -e
cd ~/klipper
MCU_CONFIG=~/q1-pro-mcu.config
TOOLHEAD_CONFIG=~/q1-pro-toolhead.config
# Compile the MCU firmware
make clean KCONFIG_CONFIG=$MCU_CONFIG
make menuconfig KCONFIG_CONFIG=$MCU_CONFIG
make KCONFIG_CONFIG=$MCU_CONFIG
# Get the version
VERSION=$(grep "// version" ~/klipper/out/compile_time_request.c | grep -oP 'v[0-9]+\.[0-9]+\.[0-9]+.*')
# Copy the firmware to the output folder
mkdir -p ~/fw/$VERSION
cp ~/klipper/out/klipper.bin ~/fw/$VERSION/qd_mcu.bin
# Compile the toolhead firmware
make clean KCONFIG_CONFIG=$TOOLHEAD_CONFIG
make menuconfig KCONFIG_CONFIG=$TOOLHEAD_CONFIG
make KCONFIG_CONFIG=$TOOLHEAD_CONFIG
# Get the version
VERSION=$(grep "// version" ~/klipper/out/compile_time_request.c | grep -oP 'v[0-9]+\.[0-9]+\.[0-9]+.*')
# Copy the firmware to the output folder
mkdir -p ~/fw/$VERSION
cp ~/klipper/out/klipper.bin ~/fw/$VERSION/qd_toolhead.bin
# Show the paths
echo
echo MCU firmware: ~/fw/$VERSION/qd_mcu.bin
echo Toolhead firmware: ~/fw/$VERSION/qd_toolhead.bin
echo
# Stop Klipper
sudo service klipper stop
# Flash the MCU
~/klipper/scripts/flash-sdcard.sh -f ~/fw/$VERSION/qd_mcu.bin /dev/ttyS0 qidi-q1-pro
# Flash the toolhead
sudo python3 ~/katapult/scripts/flashtool.py -b 250000 -r -d /dev/ttyS2
sudo python3 ~/katapult/scripts/flashtool.py -b 250000 -d /dev/ttyS2 -f ~/fw/$VERSION/qd_toolhead.bin
# Start Klipper
sudo service klipper start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment