mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-09 14:55:09 -06:00
corexy: Convert corexy to use the iterative solver
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ca0d0135dc
commit
fc4a9e7564
5 changed files with 138 additions and 42 deletions
38
klippy/chelper/kin_corexy.c
Normal file
38
klippy/chelper/kin_corexy.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
// CoreXY kinematics stepper pulse time generation
|
||||
//
|
||||
// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// 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
|
||||
|
||||
static double
|
||||
corexy_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.y;
|
||||
}
|
||||
|
||||
static double
|
||||
corexy_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.y;
|
||||
}
|
||||
|
||||
struct stepper_kinematics * __visible
|
||||
corexy_stepper_alloc(char type)
|
||||
{
|
||||
struct stepper_kinematics *sk = malloc(sizeof(*sk));
|
||||
memset(sk, 0, sizeof(*sk));
|
||||
if (type == '+')
|
||||
sk->calc_position = corexy_stepper_plus_calc_position;
|
||||
else if (type == '-')
|
||||
sk->calc_position = corexy_stepper_minus_calc_position;
|
||||
return sk;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue