aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/chelper/kin_shaper.c13
1 files changed, 13 insertions, 0 deletions
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;
}