Skip to content

Commit

Permalink
tweak name
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 27, 2021
1 parent 56407c2 commit 8d6913c
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/encoder_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void I2CPositionEncoder::update() {
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE));
SERIAL_CHAR(axis_codes[encoderAxis]);
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mms_per_step[encoderAxis], "mm");
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm");
babystep.add_steps(encoderAxis, -LROUND(errorP));
errPrstIdx = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class FilamentSensorBase {
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
const uint8_t e = b->extruder;
const int32_t steps = b->steps.e;
runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mms_per_step[E_AXIS_N(e)];
runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)];
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M92.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void GcodeSuite::M92() {
if (parser.seen('H') || wanted) {
const uint16_t argH = parser.ushortval('H'),
micro_steps = argH ?: Z_MICROSTEPS;
const float z_full_step_mm = micro_steps * planner.mms_per_step[Z_AXIS];
const float z_full_step_mm = micro_steps * planner.mm_per_step[Z_AXIS];
SERIAL_ECHO_START();
SERIAL_ECHOPGM("{ micro_steps:", micro_steps, ", z_full_step_mm:", z_full_step_mm);
if (wanted) {
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ namespace ExtUI {
* what nozzle is printing.
*/
void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles) {
const float mm = steps * planner.mms_per_step[axis];
const float mm = steps * planner.mm_per_step[axis];
UNUSED(mm);

if (!babystepAxis_steps(steps, axis)) return;
Expand Down Expand Up @@ -791,12 +791,12 @@ namespace ExtUI {
* steps that is at least mm long.
*/
int16_t mmToWholeSteps(const_float_t mm, const axis_t axis) {
const float steps = mm / planner.mms_per_step[axis];
const float steps = mm / planner.mm_per_step[axis];
return steps > 0 ? CEIL(steps) : FLOOR(steps);
}

float mmFromWholeSteps(int16_t steps, const axis_t axis) {
return steps * planner.mms_per_step[axis];
return steps * planner.mm_per_step[axis];
}

#endif // BABYSTEPPING
Expand All @@ -806,7 +806,7 @@ namespace ExtUI {
#if HAS_BED_PROBE
+ probe.offset.z
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
+ planner.mms_per_step[Z_AXIS] * babystep.axis_total[BS_AXIS_IND(Z_AXIS)]
+ planner.mm_per_step[Z_AXIS] * babystep.axis_total[BS_AXIS_IND(Z_AXIS)]
#endif
);
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_SIZE_Z);
ui.encoderPosition = 0;

const float diff = planner.mms_per_step[Z_AXIS] * babystep_increment,
const float diff = planner.mm_per_step[Z_AXIS] * babystep_increment,
new_probe_offset = probe.offset.z + diff,
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void menu_advanced_steps_per_mm() {
if (e == active_extruder)
planner.refresh_positioning();
else
planner.mms_per_step[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
planner.mm_per_step[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
});
#elif E_STEPPERS
EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); });
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
babystep.add_steps(axis, steps);
}
if (ui.should_draw()) {
const float spm = planner.mms_per_step[axis];
const float spm = planner.mm_per_step[axis];
MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(spm * babystep.accum));
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
const bool in_view = TERN1(HAS_MARLINUI_U8GLIB, PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1));
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_1024x600.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
const float bsDiff = planner.mms_per_step[Z_AXIS] * babystep_increment,
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
new_probe_offset = probe.offset.z + bsDiff,
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_320x240.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
const float bsDiff = planner.mms_per_step[Z_AXIS] * babystep_increment,
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
new_probe_offset = probe.offset.z + bsDiff,
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
const float bsDiff = planner.mms_per_step[Z_AXIS] * babystep_increment,
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
new_probe_offset = probe.offset.z + bsDiff,
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.mms_per_step[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)));
Expand All @@ -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.mms_per_step[axis];
const float mmDelta = int16_t(phaseDelta / phasePerUStep) * effectorBackoutDir * planner.mm_per_step[axis];

// Optional debug messages
if (DEBUGGING(LEVELING)) {
Expand Down Expand Up @@ -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.mms_per_step[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
Expand Down
72 changes: 36 additions & 36 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::mms_per_step[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
Expand Down Expand Up @@ -1702,7 +1702,7 @@ void Planner::endstop_triggered(const AxisEnum axis) {
}

float Planner::triggered_position_mm(const AxisEnum axis) {
return stepper.triggered_position(axis) * mms_per_step[axis];
return stepper.triggered_position(axis) * mm_per_step[axis];
}

void Planner::finish_and_disable() {
Expand Down Expand Up @@ -1759,7 +1759,7 @@ float Planner::get_axis_position_mm(const AxisEnum axis) {

#endif

return axis_steps * mms_per_step[axis];
return axis_steps * mm_per_step[axis];
}

/**
Expand Down Expand Up @@ -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 * mms_per_step[A_AXIS];
steps_dist_mm.head.y = db * mms_per_step[B_AXIS];
steps_dist_mm.z = dc * mms_per_step[Z_AXIS];
steps_dist_mm.a = (da + db) * mms_per_step[A_AXIS];
steps_dist_mm.b = CORESIGN(da - db) * mms_per_step[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 * mms_per_step[A_AXIS];
steps_dist_mm.y = db * mms_per_step[Y_AXIS];
steps_dist_mm.head.z = dc * mms_per_step[C_AXIS];
steps_dist_mm.a = (da + dc) * mms_per_step[A_AXIS];
steps_dist_mm.c = CORESIGN(da - dc) * mms_per_step[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 * mms_per_step[X_AXIS];
steps_dist_mm.head.y = db * mms_per_step[B_AXIS];
steps_dist_mm.head.z = dc * mms_per_step[C_AXIS];
steps_dist_mm.b = (db + dc) * mms_per_step[B_AXIS];
steps_dist_mm.c = CORESIGN(db - dc) * mms_per_step[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 * mms_per_step[I_AXIS];
steps_dist_mm.i = di * mm_per_step[I_AXIS];
#endif
#if LINEAR_AXES >= 5
steps_dist_mm.j = dj * mms_per_step[J_AXIS];
steps_dist_mm.j = dj * mm_per_step[J_AXIS];
#endif
#if LINEAR_AXES >= 6
steps_dist_mm.k = dk * mms_per_step[K_AXIS];
steps_dist_mm.k = dk * mm_per_step[K_AXIS];
#endif
#elif ENABLED(MARKFORGED_XY)
steps_dist_mm.head.x = da * mms_per_step[A_AXIS];
steps_dist_mm.head.y = db * mms_per_step[B_AXIS];
steps_dist_mm.z = dc * mms_per_step[Z_AXIS];
steps_dist_mm.a = (da - db) * mms_per_step[A_AXIS];
steps_dist_mm.b = db * mms_per_step[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 * mms_per_step[A_AXIS],
steps_dist_mm.b = db * mms_per_step[B_AXIS],
steps_dist_mm.c = dc * mms_per_step[C_AXIS],
steps_dist_mm.i = di * mms_per_step[I_AXIS],
steps_dist_mm.j = dj * mms_per_step[J_AXIS],
steps_dist_mm.k = dk * mms_per_step[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 * mms_per_step[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);

Expand Down Expand Up @@ -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)] * mms_per_step[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
Expand Down Expand Up @@ -3168,11 +3168,11 @@ void Planner::reset_acceleration_rates() {
}

/**
* Recalculate 'position' and 'mms_per_step'.
* Recalculate 'position' and 'mm_per_step'.
* Must be called whenever settings.axis_steps_per_mm changes!
*/
void Planner::refresh_positioning() {
LOOP_DISTINCT_AXES(i) mms_per_step[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();
}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 mms_per_step[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
Expand Down Expand Up @@ -489,7 +489,7 @@ class Planner {
static void reset_acceleration_rates();

/**
* Recalculate 'position' and 'mms_per_step'.
* Recalculate 'position' and 'mm_per_step'.
* Must be called whenever settings.axis_steps_per_mm changes!
*/
static void refresh_positioning();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ void MarlinSettings::postprocess() {

TERN_(EXTENSIBLE_UI, ExtUI::onPostprocessSettings());

// Refresh mms_per_step 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();

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.mms_per_step[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
Expand Down

0 comments on commit 8d6913c

Please sign in to comment.