kin_shaper: Fix check for optimized X or Y only calculations

The optimized version is only available if it's the only axis used.
This fixes input_shaper on corexz.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-08-30 12:04:54 -04:00
parent 08ddf25cf3
commit a7defdcad0
1 changed files with 4 additions and 5 deletions

View File

@ -332,13 +332,12 @@ input_shaper_set_sk(struct stepper_kinematics *sk
, struct stepper_kinematics *orig_sk) , struct stepper_kinematics *orig_sk)
{ {
struct input_shaper *is = container_of(sk, struct input_shaper, sk); struct input_shaper *is = container_of(sk, struct input_shaper, sk);
int af = orig_sk->active_flags & (AF_X | AF_Y); if (orig_sk->active_flags == AF_X)
if (af == (AF_X | AF_Y))
is->sk.calc_position_cb = shaper_xy_calc_position;
else if (af & AF_X)
is->sk.calc_position_cb = shaper_x_calc_position; is->sk.calc_position_cb = shaper_x_calc_position;
else if (af & AF_Y) else if (orig_sk->active_flags == AF_Y)
is->sk.calc_position_cb = shaper_y_calc_position; is->sk.calc_position_cb = shaper_y_calc_position;
else if (orig_sk->active_flags & (AF_X | AF_Y))
is->sk.calc_position_cb = shaper_xy_calc_position;
else else
return -1; return -1;
is->sk.active_flags = orig_sk->active_flags; is->sk.active_flags = orig_sk->active_flags;