Use "dist" instead of "delta" for clarity

2.0.x
Scott Lahteine 4 years ago
parent 4dea020050
commit adb6334ba0

@ -113,7 +113,7 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const
error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps
}
#endif
// Making a correction reduces the residual error and modifies delta_mm
// Making a correction reduces the residual error and adds block steps
if (error_correction) {
block->steps[axis] += ABS(error_correction);
residual_error[axis] -= error_correction;

@ -1292,12 +1292,14 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
*/
void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) {
const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOPAIR(">>> do_homing_move(", axis_codes[axis], ", ", distance, ", ");
if (fr_mm_s)
DEBUG_ECHO(fr_mm_s);
else
DEBUG_ECHOPAIR("[", homing_feedrate(axis), "]");
DEBUG_ECHOPAIR("[", real_fr_mm_s, "]");
DEBUG_ECHOLNPGM(")");
}
@ -1331,7 +1333,6 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
#endif
}
const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
#if IS_SCARA
// Tell the planner the axis is at 0
current_position[axis] = 0;
@ -1345,13 +1346,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
target[axis] = distance;
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
const xyze_float_t delta_mm_cart{0};
const xyze_float_t cart_dist_mm{0};
#endif
// Set delta/cartesian axes directly
planner.buffer_segment(target
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
, cart_dist_mm
#endif
, real_fr_mm_s, active_extruder
);

@ -1648,8 +1648,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters
) {
@ -1666,8 +1666,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target
#if HAS_POSITION_FLOAT
, target_float
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#if HAS_DIST_MM_ARG
, cart_dist_mm
#endif
, fr_mm_s, extruder, millimeters
)) {
@ -1712,8 +1712,8 @@ 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 && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
) {
@ -1840,51 +1840,51 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/
struct DeltaMM : abce_float_t {
struct DistanceMM : abce_float_t {
#if IS_CORE
xyz_pos_t head;
#endif
} delta_mm;
} steps_dist_mm;
#if IS_CORE
#if CORE_IS_XY
delta_mm.head.x = da * steps_to_mm[A_AXIS];
delta_mm.head.y = db * steps_to_mm[B_AXIS];
delta_mm.z = dc * steps_to_mm[Z_AXIS];
delta_mm.a = (da + db) * steps_to_mm[A_AXIS];
delta_mm.b = CORESIGN(da - db) * steps_to_mm[B_AXIS];
steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
steps_dist_mm.z = dc * steps_to_mm[Z_AXIS];
steps_dist_mm.a = (da + db) * steps_to_mm[A_AXIS];
steps_dist_mm.b = CORESIGN(da - db) * steps_to_mm[B_AXIS];
#elif CORE_IS_XZ
delta_mm.head.x = da * steps_to_mm[A_AXIS];
delta_mm.y = db * steps_to_mm[Y_AXIS];
delta_mm.head.z = dc * steps_to_mm[C_AXIS];
delta_mm.a = (da + dc) * steps_to_mm[A_AXIS];
delta_mm.c = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
steps_dist_mm.y = db * steps_to_mm[Y_AXIS];
steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS];
steps_dist_mm.a = (da + dc) * steps_to_mm[A_AXIS];
steps_dist_mm.c = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
#elif CORE_IS_YZ
delta_mm.x = da * steps_to_mm[X_AXIS];
delta_mm.head.y = db * steps_to_mm[B_AXIS];
delta_mm.head.z = dc * steps_to_mm[C_AXIS];
delta_mm.b = (db + dc) * steps_to_mm[B_AXIS];
delta_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
steps_dist_mm.x = da * steps_to_mm[X_AXIS];
steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS];
steps_dist_mm.b = (db + dc) * steps_to_mm[B_AXIS];
steps_dist_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
#endif
#else
delta_mm.a = da * steps_to_mm[A_AXIS];
delta_mm.b = db * steps_to_mm[B_AXIS];
delta_mm.c = dc * steps_to_mm[C_AXIS];
steps_dist_mm.a = da * steps_to_mm[A_AXIS];
steps_dist_mm.b = db * steps_to_mm[B_AXIS];
steps_dist_mm.c = dc * steps_to_mm[C_AXIS];
#endif
#if EXTRUDERS
delta_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
#else
delta_mm.e = 0.0f;
steps_dist_mm.e = 0.0f;
#endif
#if ENABLED(LCD_SHOW_E_TOTAL)
e_move_accumulator += delta_mm.e;
e_move_accumulator += steps_dist_mm.e;
#endif
if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) {
block->millimeters = (0
#if EXTRUDERS
+ ABS(delta_mm.e)
+ ABS(steps_dist_mm.e)
#endif
);
}
@ -1894,13 +1894,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
else
block->millimeters = SQRT(
#if CORE_IS_XY
sq(delta_mm.head.x) + sq(delta_mm.head.y) + sq(delta_mm.z)
sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z)
#elif CORE_IS_XZ
sq(delta_mm.head.x) + sq(delta_mm.y) + sq(delta_mm.head.z)
sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z)
#elif CORE_IS_YZ
sq(delta_mm.x) + sq(delta_mm.head.y) + sq(delta_mm.head.z)
sq(steps_dist_mm.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.head.z)
#else
sq(delta_mm.x) + sq(delta_mm.y) + sq(delta_mm.z)
sq(steps_dist_mm.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.z)
#endif
);
@ -2071,7 +2071,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#if ENABLED(FILAMENT_WIDTH_SENSOR)
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM) // Only for extruder with filament sensor
filwidth.advance_e(delta_mm.e);
filwidth.advance_e(steps_dist_mm.e);
#endif
// Calculate and limit speed in mm/sec
@ -2081,7 +2081,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Linear axes first with less logic
LOOP_XYZ(i) {
current_speed[i] = delta_mm[i] * inverse_secs;
current_speed[i] = steps_dist_mm[i] * inverse_secs;
const feedRate_t cs = ABS(current_speed[i]),
max_fr = settings.max_feedrate_mm_s[i];
if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
@ -2090,7 +2090,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Limit speed on extruders, if any
#if EXTRUDERS
{
current_speed.e = delta_mm.e * inverse_secs;
current_speed.e = steps_dist_mm.e * inverse_secs;
#if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
// Move all mixing extruders at the specified rate
if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
@ -2308,10 +2308,10 @@ 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 && DISABLED(CLASSIC_JERK)
delta_mm_cart
#if HAS_DIST_MM_ARG
cart_dist_mm
#else
{ delta_mm.x, delta_mm.y, delta_mm.z, delta_mm.e }
{ steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e }
#endif
;
unit_vec *= inverse_millimeters;
@ -2572,8 +2572,8 @@ 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 && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
) {
@ -2651,8 +2651,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
#if HAS_POSITION_FLOAT
, target_float
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#if HAS_DIST_MM_ARG
, cart_dist_mm
#endif
, fr_mm_s, extruder, millimeters
)
@ -2686,17 +2686,17 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
#if IS_KINEMATIC
#if DISABLED(CLASSIC_JERK)
const xyze_pos_t delta_mm_cart = {
const xyze_pos_t cart_dist_mm = {
rx - position_cart.x, ry - position_cart.y,
rz - position_cart.z, e - position_cart.e
};
#else
const xyz_pos_t delta_mm_cart = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z };
const xyz_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z };
#endif
float mm = millimeters;
if (mm == 0.0)
mm = (delta_mm_cart.x != 0.0 || delta_mm_cart.y != 0.0) ? delta_mm_cart.magnitude() : ABS(delta_mm_cart.z);
mm = (cart_dist_mm.x != 0.0 || cart_dist_mm.y != 0.0) ? cart_dist_mm.magnitude() : ABS(cart_dist_mm.z);
// Cartesian XYZ to kinematic ABC, stored in global 'delta'
inverse_kinematics(machine);
@ -2712,7 +2712,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
#endif
if (buffer_segment(delta.a, delta.b, delta.c, machine.e
#if DISABLED(CLASSIC_JERK)
, delta_mm_cart
, cart_dist_mm
#endif
, feedrate, extruder, mm
)) {

@ -61,6 +61,10 @@
manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f };
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
#define HAS_DIST_MM_ARG 1
#endif
enum BlockFlagBit : char {
// Recalculate trapezoids on entry junction. For optimization.
BLOCK_BIT_RECALCULATE,
@ -588,8 +592,8 @@ class Planner {
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
);
@ -611,8 +615,8 @@ class Planner {
#if HAS_POSITION_FLOAT
, const xyze_pos_t &target_float
#endif
#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#endif
, feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
);
@ -643,21 +647,21 @@ 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 && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#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 && DISABLED(CLASSIC_JERK)
, const xyze_float_t &delta_mm_cart
#if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm
#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 && DISABLED(CLASSIC_JERK)
, delta_mm_cart
#if HAS_DIST_MM_ARG
, cart_dist_mm
#endif
, fr_mm_s, extruder, millimeters);
}

Loading…
Cancel
Save