Enable junction deviation by default (#15481)

This commit is contained in:
Scott Lahteine
2019-10-08 19:42:18 -05:00
committed by GitHub
parent 1df6c7a46c
commit c0005e939c
144 changed files with 1930 additions and 2164 deletions

View File

@ -398,7 +398,7 @@ void MarlinSettings::postprocess() {
fwretract.refresh_autoretract();
#endif
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
planner.recalculate_max_e_jerk();
#endif
@ -516,7 +516,7 @@ void MarlinSettings::postprocess() {
#if HAS_CLASSIC_JERK
EEPROM_WRITE(planner.max_jerk);
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
dummy = float(DEFAULT_EJERK);
EEPROM_WRITE(dummy);
#endif
@ -1316,7 +1316,7 @@ void MarlinSettings::postprocess() {
#if HAS_CLASSIC_JERK
EEPROM_READ(planner.max_jerk);
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
EEPROM_READ(dummy);
#endif
#else
@ -2230,7 +2230,7 @@ void MarlinSettings::reset() {
#define DEFAULT_ZJERK 0
#endif
planner.max_jerk.set(DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK);
#if !BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_CLASSIC_E_JERK
planner.max_jerk.e = DEFAULT_EJERK;
#endif
#endif
@ -2749,7 +2749,7 @@ void MarlinSettings::reset() {
#endif
#if HAS_CLASSIC_JERK
SERIAL_ECHOPGM(" X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>");
#if !BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_CLASSIC_E_JERK
SERIAL_ECHOPGM(" E<max_e_jerk>");
#endif
#endif
@ -2767,7 +2767,7 @@ void MarlinSettings::reset() {
, " X", LINEAR_UNIT(planner.max_jerk.x)
, " Y", LINEAR_UNIT(planner.max_jerk.y)
, " Z", LINEAR_UNIT(planner.max_jerk.z)
#if !BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_CLASSIC_E_JERK
, " E", LINEAR_UNIT(planner.max_jerk.e)
#endif
#endif

View File

@ -1287,13 +1287,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
planner.set_machine_position_mm(target);
target[axis] = distance;
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
const xyze_float_t delta_mm_cart{0};
#endif
// Set delta/cartesian axes directly
planner.buffer_segment(target
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#endif
, real_fr_mm_s, active_extruder

View File

@ -125,7 +125,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived
float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
float Planner::junction_deviation_mm; // (mm) M205 J
#if ENABLED(LIN_ADVANCE)
#if ENABLED(DISTINCT_E_FACTORS)
@ -136,7 +136,7 @@ float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step
#endif
#endif
#if HAS_CLASSIC_JERK
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
xyz_pos_t Planner::max_jerk; // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration.
#else
xyze_pos_t Planner::max_jerk; // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration.
@ -1564,7 +1564,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters
@ -1582,7 +1582,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target
#if HAS_POSITION_FLOAT
, target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#endif
, fr_mm_s, extruder, millimeters
@ -1628,7 +1628,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
@ -2164,7 +2164,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#if ENABLED(LIN_ADVANCE)
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
#if ENABLED(DISTINCT_E_FACTORS)
#define MAX_E_JERK max_e_jerk[extruder]
#else
@ -2252,7 +2252,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
float vmax_junction_sqr; // Initial limit on the segment entry velocity (mm/s)^2
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
/**
* Compute maximum allowable entry speed at junction by centripetal acceleration approximation.
* Let a circle be tangent to both previous and current path line segments, where the junction
@ -2291,7 +2291,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
static xyze_float_t prev_unit_vec;
xyze_float_t unit_vec =
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
delta_mm_cart
#else
{ delta_mm.x, delta_mm.y, delta_mm.z, delta_mm.e }
@ -2299,7 +2299,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
;
unit_vec *= inverse_millimeters;
#if IS_CORE && ENABLED(JUNCTION_DEVIATION)
#if IS_CORE && DISABLED(CLASSIC_JERK)
/**
* On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y].
* So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters".
@ -2369,7 +2369,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
float safe_speed = nominal_speed;
uint8_t limited = 0;
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
LOOP_XYZ(i)
#else
LOOP_XYZE(i)
@ -2406,7 +2406,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Now limit the jerk in all axes.
const float smaller_speed_factor = vmax_junction / previous_nominal_speed;
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
LOOP_XYZ(axis)
#else
LOOP_XYZE(axis)
@ -2444,7 +2444,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
previous_safe_speed = safe_speed;
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
vmax_junction_sqr = _MIN(vmax_junction_sqr, sq(vmax_junction));
#else
vmax_junction_sqr = sq(vmax_junction);
@ -2538,7 +2538,7 @@ void Planner::buffer_sync_block() {
* millimeters - the length of the movement, if known
*/
bool Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
@ -2610,7 +2610,7 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
#if HAS_POSITION_FLOAT
, target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#endif
, fr_mm_s, extruder, millimeters
@ -2644,7 +2644,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
#if IS_KINEMATIC
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
const xyze_pos_t delta_mm_cart = {
rx - position_cart.x, ry - position_cart.y,
rz - position_cart.z, e - position_cart.e
@ -2668,7 +2668,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
const feedRate_t feedrate = fr_mm_s;
#endif
if (buffer_segment(delta.a, delta.b, delta.c, machine.e
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
, delta_mm_cart
#endif
, feedrate, extruder, mm
@ -2769,7 +2769,7 @@ void Planner::reset_acceleration_rates() {
if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]);
}
cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
recalculate_max_e_jerk();
#endif
}

View File

@ -245,7 +245,7 @@ class Planner {
static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
static float steps_to_mm[XYZE_N]; // Millimeters per step
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
static float junction_deviation_mm; // (mm) M205 J
#if ENABLED(LIN_ADVANCE)
static float max_e_jerk // Calculated from junction_deviation_mm
@ -257,7 +257,7 @@ class Planner {
#endif
#if HAS_CLASSIC_JERK
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
static xyz_pos_t max_jerk; // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration.
#else
static xyze_pos_t max_jerk; // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration.
@ -579,7 +579,7 @@ class Planner {
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
@ -602,7 +602,7 @@ class Planner {
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
@ -634,20 +634,20 @@ class Planner {
* millimeters - the length of the movement, if known
*/
static bool buffer_segment(const float &a, const float &b, const float &c, const float &e
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
);
FORCE_INLINE static bool buffer_segment(abce_pos_t &abce
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
) {
return buffer_segment(abce.a, abce.b, abce.c, abce.e
#if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#endif
, fr_mm_s, extruder, millimeters);
@ -865,7 +865,7 @@ class Planner {
static void autotemp_M104_M109();
#endif
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
#if HAS_LINEAR_E_JERK
FORCE_INLINE static void recalculate_max_e_jerk() {
#define GET_MAX_E_JERK(N) SQRT(SQRT(0.5) * junction_deviation_mm * (N) * RECIPROCAL(1.0 - SQRT(0.5)))
#if ENABLED(DISTINCT_E_FACTORS)
@ -937,7 +937,7 @@ class Planner {
static void recalculate();
#if ENABLED(JUNCTION_DEVIATION)
#if DISABLED(CLASSIC_JERK)
FORCE_INLINE static void normalize_junction_vector(xyze_float_t &vector) {
float magnitude_sq = 0;
@ -952,7 +952,7 @@ class Planner {
return limit_value;
}
#endif // JUNCTION_DEVIATION
#endif // !CLASSIC_JERK
};
#define PLANNER_XY_FEEDRATE() (_MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]))