🎨 steps_to_mm => mm_per_step (#22847)
This commit is contained in:
@ -1682,7 +1682,7 @@ void prepare_line_to_destination() {
|
||||
int16_t phaseDelta = (home_phase[axis] - phaseCurrent) * stepperBackoutDir;
|
||||
|
||||
// Check if home distance within endstop assumed repeatability noise of .05mm and warn.
|
||||
if (ABS(phaseDelta) * planner.steps_to_mm[axis] / phasePerUStep < 0.05f)
|
||||
if (ABS(phaseDelta) * planner.mm_per_step[axis] / phasePerUStep < 0.05f)
|
||||
SERIAL_ECHOLNPGM("Selected home phase ", home_phase[axis],
|
||||
" too close to endstop trigger phase ", phaseCurrent,
|
||||
". Pick a different phase for ", AS_CHAR(AXIS_CHAR(axis)));
|
||||
@ -1691,7 +1691,7 @@ void prepare_line_to_destination() {
|
||||
if (phaseDelta < 0) phaseDelta += 1024;
|
||||
|
||||
// Convert TMC µsteps(phase) to whole Marlin µsteps to effector backout direction to mm
|
||||
const float mmDelta = int16_t(phaseDelta / phasePerUStep) * effectorBackoutDir * planner.steps_to_mm[axis];
|
||||
const float mmDelta = int16_t(phaseDelta / phasePerUStep) * effectorBackoutDir * planner.mm_per_step[axis];
|
||||
|
||||
// Optional debug messages
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@ -1999,7 +1999,7 @@ void prepare_line_to_destination() {
|
||||
// Delta homing treats the axes as normal linear axes.
|
||||
|
||||
const float adjDistance = delta_endstop_adj[axis],
|
||||
minDistance = (MIN_STEPS_PER_SEGMENT) * planner.steps_to_mm[axis];
|
||||
minDistance = (MIN_STEPS_PER_SEGMENT) * planner.mm_per_step[axis];
|
||||
|
||||
// Retrace by the amount specified in delta_endstop_adj if more than min steps.
|
||||
if (adjDistance * (Z_HOME_DIR) < 0 && ABS(adjDistance) > minDistance) { // away from endstop, more than min distance
|
||||
|
@ -138,7 +138,7 @@ planner_settings_t Planner::settings; // Initialized by settings.load(
|
||||
|
||||
uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) Derived from mm_per_s2
|
||||
|
||||
float Planner::steps_to_mm[DISTINCT_AXES]; // (mm) Millimeters per step
|
||||
float Planner::mm_per_step[DISTINCT_AXES]; // (mm) Millimeters per step
|
||||
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
float Planner::junction_deviation_mm; // (mm) M205 J
|
||||
@ -1702,7 +1702,7 @@ void Planner::endstop_triggered(const AxisEnum axis) {
|
||||
}
|
||||
|
||||
float Planner::triggered_position_mm(const AxisEnum axis) {
|
||||
return stepper.triggered_position(axis) * steps_to_mm[axis];
|
||||
return stepper.triggered_position(axis) * mm_per_step[axis];
|
||||
}
|
||||
|
||||
void Planner::finish_and_disable() {
|
||||
@ -1759,7 +1759,7 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {
|
||||
|
||||
#endif
|
||||
|
||||
return axis_steps * steps_to_mm[axis];
|
||||
return axis_steps * mm_per_step[axis];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2015,51 +2015,51 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
} steps_dist_mm;
|
||||
#if IS_CORE
|
||||
#if CORE_IS_XY
|
||||
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];
|
||||
steps_dist_mm.head.x = da * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.head.y = db * mm_per_step[B_AXIS];
|
||||
steps_dist_mm.z = dc * mm_per_step[Z_AXIS];
|
||||
steps_dist_mm.a = (da + db) * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.b = CORESIGN(da - db) * mm_per_step[B_AXIS];
|
||||
#elif CORE_IS_XZ
|
||||
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];
|
||||
steps_dist_mm.head.x = da * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.y = db * mm_per_step[Y_AXIS];
|
||||
steps_dist_mm.head.z = dc * mm_per_step[C_AXIS];
|
||||
steps_dist_mm.a = (da + dc) * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.c = CORESIGN(da - dc) * mm_per_step[C_AXIS];
|
||||
#elif CORE_IS_YZ
|
||||
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];
|
||||
steps_dist_mm.x = da * mm_per_step[X_AXIS];
|
||||
steps_dist_mm.head.y = db * mm_per_step[B_AXIS];
|
||||
steps_dist_mm.head.z = dc * mm_per_step[C_AXIS];
|
||||
steps_dist_mm.b = (db + dc) * mm_per_step[B_AXIS];
|
||||
steps_dist_mm.c = CORESIGN(db - dc) * mm_per_step[C_AXIS];
|
||||
#endif
|
||||
#if LINEAR_AXES >= 4
|
||||
steps_dist_mm.i = di * steps_to_mm[I_AXIS];
|
||||
steps_dist_mm.i = di * mm_per_step[I_AXIS];
|
||||
#endif
|
||||
#if LINEAR_AXES >= 5
|
||||
steps_dist_mm.j = dj * steps_to_mm[J_AXIS];
|
||||
steps_dist_mm.j = dj * mm_per_step[J_AXIS];
|
||||
#endif
|
||||
#if LINEAR_AXES >= 6
|
||||
steps_dist_mm.k = dk * steps_to_mm[K_AXIS];
|
||||
steps_dist_mm.k = dk * mm_per_step[K_AXIS];
|
||||
#endif
|
||||
#elif ENABLED(MARKFORGED_XY)
|
||||
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 = db * steps_to_mm[B_AXIS];
|
||||
steps_dist_mm.head.x = da * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.head.y = db * mm_per_step[B_AXIS];
|
||||
steps_dist_mm.z = dc * mm_per_step[Z_AXIS];
|
||||
steps_dist_mm.a = (da - db) * mm_per_step[A_AXIS];
|
||||
steps_dist_mm.b = db * mm_per_step[B_AXIS];
|
||||
#else
|
||||
LINEAR_AXIS_CODE(
|
||||
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],
|
||||
steps_dist_mm.i = di * steps_to_mm[I_AXIS],
|
||||
steps_dist_mm.j = dj * steps_to_mm[J_AXIS],
|
||||
steps_dist_mm.k = dk * steps_to_mm[K_AXIS]
|
||||
steps_dist_mm.a = da * mm_per_step[A_AXIS],
|
||||
steps_dist_mm.b = db * mm_per_step[B_AXIS],
|
||||
steps_dist_mm.c = dc * mm_per_step[C_AXIS],
|
||||
steps_dist_mm.i = di * mm_per_step[I_AXIS],
|
||||
steps_dist_mm.j = dj * mm_per_step[J_AXIS],
|
||||
steps_dist_mm.k = dk * mm_per_step[K_AXIS]
|
||||
);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_EXTRUDERS, steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]);
|
||||
TERN_(HAS_EXTRUDERS, steps_dist_mm.e = esteps_float * mm_per_step[E_AXIS_N(extruder)]);
|
||||
|
||||
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
|
||||
|
||||
@ -2889,7 +2889,7 @@ bool Planner::buffer_segment(const abce_pos_t &abce
|
||||
// When changing extruders recalculate steps corresponding to the E position
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
if (last_extruder != extruder && settings.axis_steps_per_mm[E_AXIS_N(extruder)] != settings.axis_steps_per_mm[E_AXIS_N(last_extruder)]) {
|
||||
position.e = LROUND(position.e * settings.axis_steps_per_mm[E_AXIS_N(extruder)] * steps_to_mm[E_AXIS_N(last_extruder)]);
|
||||
position.e = LROUND(position.e * settings.axis_steps_per_mm[E_AXIS_N(extruder)] * mm_per_step[E_AXIS_N(last_extruder)]);
|
||||
last_extruder = extruder;
|
||||
}
|
||||
#endif
|
||||
@ -3168,11 +3168,11 @@ void Planner::reset_acceleration_rates() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate 'position' and 'steps_to_mm'.
|
||||
* Recalculate 'position' and 'mm_per_step'.
|
||||
* Must be called whenever settings.axis_steps_per_mm changes!
|
||||
*/
|
||||
void Planner::refresh_positioning() {
|
||||
LOOP_DISTINCT_AXES(i) steps_to_mm[i] = 1.0f / settings.axis_steps_per_mm[i];
|
||||
LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i];
|
||||
set_position_mm(current_position);
|
||||
reset_acceleration_rates();
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ class Planner {
|
||||
#endif
|
||||
|
||||
static uint32_t max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) Derived from mm_per_s2
|
||||
static float steps_to_mm[DISTINCT_AXES]; // Millimeters per step
|
||||
static float mm_per_step[DISTINCT_AXES]; // Millimeters per step
|
||||
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
static float junction_deviation_mm; // (mm) M205 J
|
||||
@ -489,7 +489,7 @@ class Planner {
|
||||
static void reset_acceleration_rates();
|
||||
|
||||
/**
|
||||
* Recalculate 'position' and 'steps_to_mm'.
|
||||
* Recalculate 'position' and 'mm_per_step'.
|
||||
* Must be called whenever settings.axis_steps_per_mm changes!
|
||||
*/
|
||||
static void refresh_positioning();
|
||||
|
@ -557,7 +557,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPostprocessSettings());
|
||||
|
||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||
// Refresh mm_per_step with the reciprocal of axis_steps_per_mm
|
||||
// and init stepper.count[], planner.position[] with current_position
|
||||
planner.refresh_positioning();
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
|
||||
lpq[lpq_ptr] = 0;
|
||||
|
||||
if (++lpq_ptr >= lpq_len) lpq_ptr = 0;
|
||||
work_pid[ee].Kc = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, ee);
|
||||
work_pid[ee].Kc = (lpq[lpq_ptr] * planner.mm_per_step[E_AXIS]) * PID_PARAM(Kc, ee);
|
||||
pid_output += work_pid[ee].Kc;
|
||||
}
|
||||
#endif // PID_EXTRUSION_SCALING
|
||||
|
Reference in New Issue
Block a user