-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,22 @@ def compare_belts_responses(gcmd, config, st_process: ShakeTuneProcess) -> None: | |
res_tester = printer.lookup_object('resonance_tester') | ||
systime = printer.get_reactor().monotonic() | ||
|
||
min_freq = gcmd.get_float('FREQ_START', default=res_tester.test.min_freq, minval=1) | ||
max_freq = gcmd.get_float('FREQ_END', default=res_tester.test.max_freq, minval=1) | ||
# Get the default values for the frequency range and the acceleration per Hz | ||
if hasattr(res_tester, 'test'): | ||
# Old Klipper code (before Dec 6, 2024: https://github.com/Klipper3d/klipper/commit/16b4b6b302ac3ffcd55006cd76265aad4e26ecc8) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Frix-x
Author
Owner
|
||
default_min_freq = res_tester.test.min_freq | ||
default_max_freq = res_tester.test.max_freq | ||
default_accel_per_hz = res_tester.test.accel_per_hz | ||
test_points = res_tester.test.get_start_test_points() | ||
else: | ||
# New Klipper code (after Dec 6, 2024) with the sweeping test | ||
default_min_freq = res_tester.generator.vibration_generator.min_freq | ||
default_max_freq = res_tester.generator.vibration_generator.max_freq | ||
default_accel_per_hz = res_tester.generator.vibration_generator.accel_per_hz | ||
test_points = res_tester.probe_points | ||
|
||
min_freq = gcmd.get_float('FREQ_START', default=default_min_freq, minval=1) | ||
max_freq = gcmd.get_float('FREQ_END', default=default_max_freq, minval=1) | ||
hz_per_sec = gcmd.get_float('HZ_PER_SEC', default=1, minval=1) | ||
accel_per_hz = gcmd.get_float('ACCEL_PER_HZ', default=None) | ||
feedrate_travel = gcmd.get_float('TRAVEL_SPEED', default=120.0, minval=20.0) | ||
|
@@ -34,7 +48,7 @@ def compare_belts_responses(gcmd, config, st_process: ShakeTuneProcess) -> None: | |
accel_per_hz = None | ||
|
||
if accel_per_hz is None: | ||
accel_per_hz = res_tester.test.accel_per_hz | ||
accel_per_hz = default_accel_per_hz | ||
|
||
gcode = printer.lookup_object('gcode') | ||
|
||
|
@@ -63,7 +77,6 @@ def compare_belts_responses(gcmd, config, st_process: ShakeTuneProcess) -> None: | |
accelerometer = Accelerometer(printer.lookup_object(accel_chip), printer.get_reactor()) | ||
|
||
# Move to the starting point | ||
test_points = res_tester.test.get_start_test_points() | ||
if len(test_points) > 1: | ||
raise gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.') | ||
if test_points[0] == (-1, -1, -1): | ||
|
Looks like three times the same code.
It might be good to extract that into a function that is then called at the three call sites that need the data.