diff options
author | Voron <44981431+VoronDesign@users.noreply.github.com> | 2020-07-30 09:42:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-30 12:42:23 -0400 |
commit | 9213646c63c6027a7c43ad254ba9cf09ebd166df (patch) | |
tree | d1f0fd11b0b68c87a1577f72c7320f9a9057e5d4 /klippy/chelper/kin_corexz.c | |
parent | f3b980c1b273ede20f5db5d017ce0bcc715640eb (diff) | |
download | kutter-9213646c63c6027a7c43ad254ba9cf09ebd166df.tar.gz kutter-9213646c63c6027a7c43ad254ba9cf09ebd166df.tar.xz kutter-9213646c63c6027a7c43ad254ba9cf09ebd166df.zip |
corexz: Add CoreXZ kinematics (#3129)
Add a CoreXZ kinematics
Signed-off-by: Maks Zolin <mzolin@vorondesign.com>
Diffstat (limited to 'klippy/chelper/kin_corexz.c')
-rw-r--r-- | klippy/chelper/kin_corexz.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/klippy/chelper/kin_corexz.c b/klippy/chelper/kin_corexz.c new file mode 100644 index 00000000..320dc239 --- /dev/null +++ b/klippy/chelper/kin_corexz.c @@ -0,0 +1,40 @@ +// CoreXZ kinematics stepper pulse time generation +// +// Copyright (C) 2020 Maks Zolin <mzolin@vorondesign.com> +// +// This file may be distributed under the terms of the GNU GPLv3 license. + +#include <stdlib.h> // malloc +#include <string.h> // memset +#include "compiler.h" // __visible +#include "itersolve.h" // struct stepper_kinematics +#include "trapq.h" // move_get_coord + +static double +corexz_stepper_plus_calc_position(struct stepper_kinematics *sk, struct move *m + , double move_time) +{ + struct coord c = move_get_coord(m, move_time); + return c.x + c.z; +} + +static double +corexz_stepper_minus_calc_position(struct stepper_kinematics *sk, struct move *m + , double move_time) +{ + struct coord c = move_get_coord(m, move_time); + return c.x - c.z; +} + +struct stepper_kinematics * __visible +corexz_stepper_alloc(char type) +{ + struct stepper_kinematics *sk = malloc(sizeof(*sk)); + memset(sk, 0, sizeof(*sk)); + if (type == '+') + sk->calc_position_cb = corexz_stepper_plus_calc_position; + else if (type == '-') + sk->calc_position_cb = corexz_stepper_minus_calc_position; + sk->active_flags = AF_X | AF_Z; + return sk; +} |