aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/shaper_calibrate.py
diff options
context:
space:
mode:
authorDmitry Butyugin <dmbutyugin@google.com>2024-02-17 15:14:03 +0100
committerKevinOConnor <kevin@koconnor.net>2024-02-17 18:25:39 -0500
commit28f06a104bc0cfe3a7d36db343ade5a805b3e132 (patch)
tree2f775b4030020044cd16714700cd76976b193ff4 /klippy/extras/shaper_calibrate.py
parent72b301a2859c3f7ed26d802dd52fc495eef6c353 (diff)
downloadkutter-28f06a104bc0cfe3a7d36db343ade5a805b3e132.tar.gz
kutter-28f06a104bc0cfe3a7d36db343ade5a805b3e132.tar.xz
kutter-28f06a104bc0cfe3a7d36db343ade5a805b3e132.zip
shaper_calibrate: Fixed crashes in SHAPER_CALIBRATE and TEST_RESONANCES
Fixed crashes due to wrong parameter passed to the shaper selection function and when the custom FREQ_END is specified. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Diffstat (limited to 'klippy/extras/shaper_calibrate.py')
-rw-r--r--klippy/extras/shaper_calibrate.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/klippy/extras/shaper_calibrate.py b/klippy/extras/shaper_calibrate.py
index f3bfd8d2..6891fefb 100644
--- a/klippy/extras/shaper_calibrate.py
+++ b/klippy/extras/shaper_calibrate.py
@@ -368,8 +368,10 @@ class ShaperCalibrate:
"SHAPER_TYPE_" + axis: shaper_name,
"SHAPER_FREQ_" + axis: shaper_freq}))
- def save_calibration_data(self, output, calibration_data, shapers=None):
+ def save_calibration_data(self, output, calibration_data, shapers=None,
+ max_freq=None):
try:
+ max_freq = max_freq or MAX_FREQ
with open(output, "w") as csvfile:
csvfile.write("freq,psd_x,psd_y,psd_z,psd_xyz")
if shapers:
@@ -378,7 +380,7 @@ class ShaperCalibrate:
csvfile.write("\n")
num_freqs = calibration_data.freq_bins.shape[0]
for i in range(num_freqs):
- if calibration_data.freq_bins[i] >= MAX_FREQ:
+ if calibration_data.freq_bins[i] >= max_freq:
break
csvfile.write("%.1f,%.3e,%.3e,%.3e,%.3e" % (
calibration_data.freq_bins[i],