Add UBL support for G2/G3 and G5 (#10648)

This commit is contained in:
Scott Lahteine
2018-05-08 11:10:45 -05:00
committed by GitHub
parent 2cdaf76c40
commit 19f189b4e5
5 changed files with 34 additions and 9 deletions

View File

@ -1190,7 +1190,7 @@ void Planner::check_axes_activity() {
}
#endif
#if PLANNER_LEVELING
#if PLANNER_LEVELING || HAS_UBL_AND_CURVES
/**
* rx, ry, rz - Cartesian positions in mm
* Leveled XYZ on completion
@ -1242,6 +1242,10 @@ void Planner::check_axes_activity() {
#endif
}
#endif
#if PLANNER_LEVELING
void Planner::unapply_leveling(float raw[XYZ]) {
if (leveling_active) {

View File

@ -404,19 +404,24 @@ class Planner {
#endif // SKEW_CORRECTION
#if PLANNER_LEVELING
#define ARG_X float rx
#define ARG_Y float ry
#define ARG_Z float rz
#if PLANNER_LEVELING || HAS_UBL_AND_CURVES
/**
* Apply leveling to transform a cartesian position
* as it will be given to the planner and steppers.
*/
static void apply_leveling(float &rx, float &ry, float &rz);
static void apply_leveling(float (&raw)[XYZ]) { apply_leveling(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]); }
static void unapply_leveling(float raw[XYZ]);
FORCE_INLINE static void apply_leveling(float (&raw)[XYZ]) { apply_leveling(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]); }
#if PLANNER_LEVELING
#define ARG_X float rx
#define ARG_Y float ry
#define ARG_Z float rz
static void unapply_leveling(float raw[XYZ]);
#endif
#else

View File

@ -190,7 +190,14 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
bez_target[Z_AXIS] = interp(position[Z_AXIS], target[Z_AXIS], t);
bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
clamp_to_software_endstops(bez_target);
planner.buffer_line_kinematic(bez_target, fr_mm_s, extruder);
#if HAS_UBL_AND_CURVES
float pos[XYZ] = { bez_target[X_AXIS], bez_target[Y_AXIS], bez_target[Z_AXIS] };
planner.apply_leveling(pos);
planner.buffer_segment(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS], bez_target[E_AXIS], fr_mm_s, active_extruder);
#else
planner.buffer_line_kinematic(bez_target, fr_mm_s, extruder);
#endif
}
}