From 28f06a104bc0cfe3a7d36db343ade5a805b3e132 Mon Sep 17 00:00:00 2001 From: Dmitry Butyugin Date: Sat, 17 Feb 2024 15:14:03 +0100 Subject: 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 --- klippy/extras/shaper_calibrate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy/extras/shaper_calibrate.py') 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], -- cgit v1.2.3-70-g09d2