Improve planner kinematics, fix delta ABL
This commit is contained in:
committed by
Scott Lahteine
parent
48761f2021
commit
f8c2473a71
@ -43,6 +43,12 @@
|
||||
class Planner;
|
||||
extern Planner planner;
|
||||
|
||||
#if IS_KINEMATIC
|
||||
// for inline buffer_line_kinematic
|
||||
extern float delta[ABC];
|
||||
void inverse_kinematics(const float logical[XYZ]);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct block_t
|
||||
*
|
||||
@ -218,18 +224,63 @@ class Planner {
|
||||
* as it will be given to the planner and steppers.
|
||||
*/
|
||||
static void apply_leveling(float &lx, float &ly, float &lz);
|
||||
static void apply_leveling(float logical[XYZ]) { apply_leveling(logical[X_AXIS], logical[Y_AXIS], logical[Z_AXIS]); }
|
||||
static void unapply_leveling(float logical[XYZ]);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Planner::_buffer_line
|
||||
*
|
||||
* Add a new linear movement to the buffer.
|
||||
* Doesn't apply the leveling.
|
||||
*
|
||||
* x,y,z,e - target position in mm
|
||||
* fr_mm_s - (target) speed of the move
|
||||
* extruder - target extruder
|
||||
*/
|
||||
static void _buffer_line(const float &lx, const float &ly, const float &lz, const float &e, float fr_mm_s, const uint8_t extruder);
|
||||
|
||||
static void _set_position_mm(const float &lx, const float &ly, const float &lz, const float &e);
|
||||
|
||||
/**
|
||||
* Add a new linear movement to the buffer.
|
||||
* The target is NOT translated to delta/scara
|
||||
*
|
||||
* x,y,z,e - target position in mm
|
||||
* fr_mm_s - (target) speed of the move (mm/s)
|
||||
* extruder - target extruder
|
||||
*/
|
||||
static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float& e, float fr_mm_s, const uint8_t extruder);
|
||||
static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, const uint8_t extruder) {
|
||||
#if PLANNER_LEVELING && ! IS_KINEMATIC
|
||||
apply_leveling(lx, ly, lz);
|
||||
#endif
|
||||
_buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new linear movement to the buffer.
|
||||
* The target is cartesian, it's translated to delta/scara if
|
||||
* needed.
|
||||
*
|
||||
* target - x,y,z,e CARTESIAN target in mm
|
||||
* fr_mm_s - (target) speed of the move (mm/s)
|
||||
* extruder - target extruder
|
||||
*/
|
||||
static FORCE_INLINE void buffer_line_kinematic(const float target[NUM_AXIS], float fr_mm_s, const uint8_t extruder) {
|
||||
#if PLANNER_LEVELING
|
||||
float pos[XYZ] = { target[X_AXIS], target[Y_AXIS], target[Z_AXIS] };
|
||||
apply_leveling(pos);
|
||||
#else
|
||||
const float * const pos = target;
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
inverse_kinematics(pos);
|
||||
_buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], target[E_AXIS], fr_mm_s, extruder);
|
||||
#else
|
||||
_buffer_line(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS], target[E_AXIS], fr_mm_s, extruder);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the planner.position and individual stepper positions.
|
||||
@ -240,9 +291,14 @@ class Planner {
|
||||
*
|
||||
* Clears previous speed values.
|
||||
*/
|
||||
static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e);
|
||||
static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
|
||||
#if PLANNER_LEVELING && ! IS_KINEMATIC
|
||||
apply_leveling(lx, ly, lz);
|
||||
#endif
|
||||
_set_position_mm(lx, ly, lz, e);
|
||||
}
|
||||
static void set_position_mm_kinematic(const float position[NUM_AXIS]);
|
||||
static void set_position_mm(const AxisEnum axis, const float& v);
|
||||
|
||||
static FORCE_INLINE void set_z_position_mm(const float& z) { set_position_mm(Z_AXIS, z); }
|
||||
static FORCE_INLINE void set_e_position_mm(const float& e) { set_position_mm(E_AXIS, e); }
|
||||
|
||||
|
Reference in New Issue
Block a user