Skip to content

Commit d3d6087

Browse files
committed
Initial Port of Klippain v5.1.1 for Qidi Plus 4
1 parent d59da30 commit d3d6087

22 files changed

+933
-262
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Klipper Shake&Tune plugin
22

3+
This is a dedicated port of the Klippain Shake&Tune v5.1.1 module for installation on the Qidi Plus4 3D Printer
4+
35
Shake&Tune is a Klipper plugin from the [Klippain](https://github.com/Frix-x/klippain) ecosystem, designed to create insightful visualizations to help you troubleshoot your mechanical problems and give you tools to better calibrate the input shaper filters on your 3D printer. It can be installed on any Klipper machine and is not limited to those using the full Klippain.
46

57
Check out the **[detailed documentation here](./docs/README.md)**.
@@ -10,12 +12,18 @@ Check out the **[detailed documentation here](./docs/README.md)**.
1012
## Installation
1113

1214
Follow these steps to install Shake&Tune on your printer:
13-
1. Be sure to have a working accelerometer on your machine and a `[resonance_tester]` section defined. You can follow the official [Measuring Resonances Klipper documentation](https://www.klipper3d.org/Measuring_Resonances.html) to configure it.
14-
1. Install Shake&Tune by running over SSH on your printer:
15-
```bash
16-
wget -O - https://raw.githubusercontent.com/Frix-x/klippain-shaketune/main/install.sh | bash
15+
1. Very Important:
16+
17+
If you have an automated update section named `[update_manager Klippain-ShakeTune]` in your `moonraker.cfg` file, please delete it before proceeding
18+
1. Install Shake&Tune on your Plus4 by running over SSH on your printer:
1719
```
18-
1. Then, append the following to your `printer.cfg` file and restart Klipper:
20+
cd /home/mks
21+
git clone https://github.com/qidi-community/klippain_v511_for_qidi_plus4.git
22+
cd klippain_v511_for_qidi_plus4
23+
./install.sh
24+
25+
```
26+
1. Then, insert the following into your `printer.cfg` file BEFORE the `SAVE_CONFIG` section and restart Klipper:
1927
```
2028
[shaketune]
2129
# result_folder: ~/printer_data/config/ShakeTune_results
@@ -57,4 +65,15 @@ Follow these steps to install Shake&Tune on your printer:
5765
# without using too much RAM to generate them. Usually, you shouldn't need to change this value.
5866
```
5967
68+
## Documentation
69+
6070
Don't forget to check out **[Shake&Tune documentation here](./docs/README.md)**.
71+
72+
73+
## Acknowledgement
74+
75+
This repository is a fork modified and tailored for the Qidi Plus 4 3D Printer.
76+
77+
It should be noted that all of Klippain-Shaketune is authored by Félix Boisselier <[email protected]>
78+
79+
All acknowledgement and respect to Félix for his excellent work!

backups/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A place-holder for where config backups can be placed

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ First, you may want to read the **[input shaping and tuning generalities](./is_t
1414

1515
| Shake&Tune command | Resulting graphs example |
1616
|:------|:-------:|
17-
|[`AXES_MAP_CALIBRATION`](./macros/axes_map_calibration.md)<br /><br />Verify that your accelerometer is working correctly and automatically find its Klipper's `axes_map` parameter | [<img src="./images/axesmap_example.png">](./macros/axes_map_calibration.md) |
1817
|[`COMPARE_BELTS_RESPONSES`](./macros/compare_belts_responses.md)<br /><br />Generate a differential belt resonance graph to verify relative belt tensions and belt path behaviors on a CoreXY or CoreXZ printer | [<img src="./images/belts_example.png">](./macros/compare_belts_responses.md) |
1918
|[`AXES_SHAPER_CALIBRATION`](./macros/axes_shaper_calibrations.md)<br /><br />Create the usual input shaper graphs to tune Klipper's input shaper filters and reduce ringing/ghosting | [<img src="./images/axis_example.png">](./macros/axes_shaper_calibrations.md) |
2019
|[`CREATE_VIBRATIONS_PROFILE`](./macros/create_vibrations_profile.md)<br /><br />Measure your global machine vibrations as a function of toolhead direction and speed to find problematic ranges where the printer could be exposed to more VFAs in order to optimize your slicer speed profiles and TMC drivers parameters | [<img src="./images/vibrations_example.png">](./macros/create_vibrations_profile.md) |
-165 KB
Binary file not shown.

docs/images/axesmap_example.png

-490 KB
Binary file not shown.

docs/macros/axes_map_calibration.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

install.sh

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ KLIPPER_PATH="${HOME}/klipper"
66
KLIPPER_VENV_PATH="${KLIPPER_VENV:-${HOME}/klippy-env}"
77

88
OLD_K_SHAKETUNE_VENV="${HOME}/klippain_shaketune-env"
9-
K_SHAKETUNE_PATH="${HOME}/klippain_shaketune"
9+
K_SHAKETUNE_PATH="${HOME}/klippain_v511_for_qidi_plus4"
1010

1111
set -eu
1212
export LC_ALL=C
@@ -30,6 +30,21 @@ function preflight_checks {
3030
exit -1
3131
fi
3232

33+
if [ ! -e resonance_tester.py ]; then
34+
echo "[ERROR] Please run the install script from within the directory where the install script is located"
35+
exit -1
36+
fi
37+
38+
if [ ! -e shaper_calibrate.py ]; then
39+
echo "[ERROR] Please run the install script from within the directory where the install script is located"
40+
exit -1
41+
fi
42+
43+
if [ ! -e install.sh ]; then
44+
echo "[ERROR] Please run the install script from within the directory where the install script is located"
45+
exit -1
46+
fi
47+
3348
install_package_requirements
3449
}
3550

@@ -57,25 +72,6 @@ function install_package_requirements {
5772
fi
5873
}
5974

60-
function check_download {
61-
local shaketunedirname shaketunebasename
62-
shaketunedirname="$(dirname ${K_SHAKETUNE_PATH})"
63-
shaketunebasename="$(basename ${K_SHAKETUNE_PATH})"
64-
65-
if [ ! -d "${K_SHAKETUNE_PATH}" ]; then
66-
echo "[DOWNLOAD] Downloading Klippain Shake&Tune module repository..."
67-
if git -C $shaketunedirname clone https://github.com/Frix-x/klippain-shaketune.git $shaketunebasename; then
68-
chmod +x ${K_SHAKETUNE_PATH}/install.sh
69-
printf "[DOWNLOAD] Download complete!\n\n"
70-
else
71-
echo "[ERROR] Download of Klippain Shake&Tune module git repository failed!"
72-
exit -1
73-
fi
74-
else
75-
printf "[DOWNLOAD] Klippain Shake&Tune module repository already found locally. Continuing...\n\n"
76-
fi
77-
}
78-
7975
function setup_venv {
8076
if [ ! -d "${KLIPPER_VENV_PATH}" ]; then
8177
echo "[ERROR] Klipper's Python virtual environment not found!"
@@ -87,6 +83,7 @@ function setup_venv {
8783
rm -rf "${OLD_K_SHAKETUNE_VENV}"
8884
fi
8985

86+
declare -x PS1=""
9087
source "${KLIPPER_VENV_PATH}/bin/activate"
9188
echo "[SETUP] Installing/Updating K-Shake&Tune dependencies..."
9289
pip install --upgrade pip
@@ -112,32 +109,16 @@ function link_extension {
112109
}
113110

114111
function link_module {
115-
if [ ! -d "${KLIPPER_PATH}/klippy/extras/shaketune" ]; then
116-
echo "[INSTALL] Linking Shake&Tune module to Klipper extras"
117-
ln -frsn ${K_SHAKETUNE_PATH}/shaketune ${KLIPPER_PATH}/klippy/extras/shaketune
118-
else
119-
printf "[INSTALL] Klippain Shake&Tune Klipper module is already installed. Continuing...\n\n"
120-
fi
112+
echo "[INSTALL] Linking Shake&Tune module to Klipper extras"
113+
ln -frsn ${K_SHAKETUNE_PATH}/shaketune ${KLIPPER_PATH}/klippy/extras/shaketune
121114
}
122115

123-
function add_updater {
124-
update_section=$(grep -c '\[update_manager[a-z ]* Klippain-ShakeTune\]' $MOONRAKER_CONFIG || true)
125-
if [ "$update_section" -eq 0 ]; then
126-
echo -n "[INSTALL] Adding update manager to moonraker.conf..."
127-
cat <<EOF >>$MOONRAKER_CONFIG
128-
129-
## Klippain Shake&Tune automatic update management
130-
[update_manager Klippain-ShakeTune]
131-
type: git_repo
132-
origin: https://github.com/Frix-x/klippain-shaketune.git
133-
path: ~/klippain_shaketune
134-
virtualenv: ${KLIPPER_VENV_PATH}
135-
requirements: requirements.txt
136-
system_dependencies: system-dependencies.json
137-
primary_branch: main
138-
managed_services: klipper
139-
EOF
140-
fi
116+
function update_klipper {
117+
DATE=$(date +"%Y%m%d%H%M%S")
118+
mkdir -p ${K_SHAKETUNE_PATH}/backups
119+
cp /home/mks/klipper/klippy/extras/resonance_tester.py ${K_SHAKETUNE_PATH}/backups/resonance_tester.py.$DATE
120+
cp /home/mks/klipper/klippy/extras/shaper_calibrate.py ${K_SHAKETUNE_PATH}/backups/shaper_calibrate.py.$DATE
121+
cp resonance_tester.py shaper_calibrate.py /home/mks/klipper/klippy/extras
141122
}
142123

143124
function restart_klipper {
@@ -150,18 +131,16 @@ function restart_moonraker {
150131
sudo systemctl restart moonraker
151132
}
152133

153-
154134
printf "\n=============================================\n"
155135
echo "- Klippain Shake&Tune module install script -"
156136
printf "=============================================\n\n"
157137

158138

159139
# Run steps
160140
preflight_checks
161-
check_download
162141
setup_venv
163142
link_extension
164143
link_module
165-
add_updater
144+
update_klipper
166145
restart_klipper
167146
restart_moonraker

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Issues = "https://github.com/Frix-x/klippain-shaketune/issues"
1616
Changelog = "https://github.com/Frix-x/klippain-shaketune/releases"
1717

1818
[tool.ruff]
19-
line-length = 120 # We all have modern screens now and I believe this should be brought in line with current technology
19+
line-length = 160 # We all have modern screens now and I believe this should be brought in line with current technology
2020
indent-width = 4
2121
target-version = "py39"
2222

requirements.old

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GitPython==3.1.41
2+
matplotlib==3.8.2
3+
numpy==1.26.2
4+
scipy==1.11.4
5+
PyWavelets==1.6.0
6+
zstandard==0.23.0

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GitPython==3.1.41
2-
matplotlib==3.8.2
3-
numpy==1.26.2
4-
scipy==1.11.4
5-
PyWavelets==1.6.0
6-
zstandard==0.23.0
2+
matplotlib==3.5.3
3+
numpy==1.21.6
4+
scipy==1.7.3
5+
PyWavelets==1.3.0
6+
zstandard==0.21.0

0 commit comments

Comments
 (0)