toolhead: Use dict for step generation flush times. (#6303)

Makes the API to extruder and input shaper more robust, avoiding the need to track the old delay.

Signed-off-by: Viesturs Zariņš <viesturz@gmail.com>
This commit is contained in:
Viesturs Zariņš 2023-10-19 19:28:16 +02:00 committed by GitHub
parent 0c521b601d
commit 6749985302
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 17 deletions

View file

@ -135,16 +135,13 @@ class InputShaper:
is_sk = self._get_input_shaper_stepper_kinematics(s)
if is_sk is None:
continue
old_delay = ffi_lib.input_shaper_get_step_generation_window(is_sk)
for shaper in self.shapers:
if shaper in failed_shapers:
continue
if not shaper.set_shaper_kinematics(is_sk):
failed_shapers.append(shaper)
new_delay = ffi_lib.input_shaper_get_step_generation_window(is_sk)
if old_delay != new_delay:
self.toolhead.note_step_generation_scan_time(new_delay,
old_delay)
self.toolhead.note_step_generation_scan_time(self, new_delay)
if failed_shapers:
error = error or self.printer.command_error
raise error("Failed to configure shaper(s) %s with given parameters"