From 47aa28e5300d75764add52e34b23b1804147626c Mon Sep 17 00:00:00 2001 From: Dmitry Butyugin Date: Sun, 2 Mar 2025 01:45:57 +0100 Subject: input_shaper: Fix for polar kinematics Forward post_cb calls from itersolve to the original kinematics. Signed-off-by: Dmitry Butyugin --- klippy/chelper/kin_shaper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/klippy/chelper/kin_shaper.c b/klippy/chelper/kin_shaper.c index 18d14143..acdd1ccc 100644 --- a/klippy/chelper/kin_shaper.c +++ b/klippy/chelper/kin_shaper.c @@ -156,6 +156,16 @@ shaper_xy_calc_position(struct stepper_kinematics *sk, struct move *m return is->orig_sk->calc_position_cb(is->orig_sk, &is->m, DUMMY_T); } +// A callback that forwards post_cb call to the original kinematics +static void +shaper_commanded_pos_post_fixup(struct stepper_kinematics *sk) +{ + struct input_shaper *is = container_of(sk, struct input_shaper, sk); + is->orig_sk->commanded_pos = sk->commanded_pos; + is->orig_sk->post_cb(is->orig_sk); + sk->commanded_pos = is->orig_sk->commanded_pos; +} + int __visible input_shaper_set_sk(struct stepper_kinematics *sk , struct stepper_kinematics *orig_sk) @@ -174,6 +184,9 @@ input_shaper_set_sk(struct stepper_kinematics *sk is->sk.commanded_pos = orig_sk->commanded_pos; is->sk.last_flush_time = orig_sk->last_flush_time; is->sk.last_move_time = orig_sk->last_move_time; + if (orig_sk->post_cb) { + is->sk.post_cb = shaper_commanded_pos_post_fixup; + } return 0; } -- cgit v1.2.3-70-g09d2