mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-08 14:34:06 -06:00
polar: Implement bed angle wrapping adjustments in chelper code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
92993c062b
commit
374eb98765
4 changed files with 19 additions and 10 deletions
|
@ -32,14 +32,26 @@ polar_stepper_angle_calc_position(struct stepper_kinematics *sk, struct move *m
|
|||
return angle;
|
||||
}
|
||||
|
||||
static void
|
||||
polar_stepper_angle_post_fixup(struct stepper_kinematics *sk)
|
||||
{
|
||||
// Normalize the stepper_bed angle
|
||||
if (sk->commanded_pos < -M_PI)
|
||||
sk->commanded_pos += 2 * M_PI;
|
||||
else if (sk->commanded_pos > M_PI)
|
||||
sk->commanded_pos -= 2 * M_PI;
|
||||
}
|
||||
|
||||
struct stepper_kinematics * __visible
|
||||
polar_stepper_alloc(char type)
|
||||
{
|
||||
struct stepper_kinematics *sk = malloc(sizeof(*sk));
|
||||
memset(sk, 0, sizeof(*sk));
|
||||
if (type == 'r')
|
||||
if (type == 'r') {
|
||||
sk->calc_position_cb = polar_stepper_radius_calc_position;
|
||||
else if (type == 'a')
|
||||
} else if (type == 'a') {
|
||||
sk->calc_position_cb = polar_stepper_angle_calc_position;
|
||||
sk->post_cb = polar_stepper_angle_post_fixup;
|
||||
}
|
||||
return sk;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue