Rename axis_steps_per_unit to axis_steps_per_mm

This commit is contained in:
Guðni Már Gilbert 2023-05-23 18:37:06 +00:00 committed by DRracer
parent ff1cd2bfb2
commit 21faa52aab
10 changed files with 75 additions and 75 deletions

View File

@ -30,7 +30,7 @@ void Config_PrintSettings(uint8_t level)
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
"%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
),
echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS],
echomagic, echomagic, cs.axis_steps_per_mm[X_AXIS], cs.axis_steps_per_mm[Y_AXIS], cs.axis_steps_per_mm[Z_AXIS], cs.axis_steps_per_mm[E_AXIS],
echomagic, echomagic, cs.axis_ustep_resolution[X_AXIS], cs.axis_ustep_resolution[Y_AXIS], cs.axis_ustep_resolution[Z_AXIS], cs.axis_ustep_resolution[E_AXIS],
echomagic, echomagic, cs.max_feedrate_normal[X_AXIS], cs.max_feedrate_normal[Y_AXIS], cs.max_feedrate_normal[Z_AXIS], cs.max_feedrate_normal[E_AXIS],
echomagic, echomagic, cs.max_feedrate_silent[X_AXIS], cs.max_feedrate_silent[Y_AXIS], cs.max_feedrate_silent[Z_AXIS], cs.max_feedrate_silent[E_AXIS],
@ -48,7 +48,7 @@ void Config_PrintSettings(uint8_t level)
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
"%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
),
echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS],
echomagic, echomagic, cs.axis_steps_per_mm[X_AXIS], cs.axis_steps_per_mm[Y_AXIS], cs.axis_steps_per_mm[Z_AXIS], cs.axis_steps_per_mm[E_AXIS],
echomagic, echomagic, max_feedrate[X_AXIS], max_feedrate[Y_AXIS], max_feedrate[Z_AXIS], max_feedrate[E_AXIS],
echomagic, echomagic, max_acceleration_units_per_sq_second[X_AXIS], max_acceleration_units_per_sq_second[Y_AXIS], max_acceleration_units_per_sq_second[Z_AXIS], max_acceleration_units_per_sq_second[E_AXIS],
echomagic, echomagic, cs.acceleration, cs.retract_acceleration, cs.travel_acceleration,
@ -114,7 +114,7 @@ void Config_PrintSettings(uint8_t level)
static_assert (EXTRUDERS == 1, "ConfigurationStore M500_conf not implemented for more extruders, fix filament_size array size.");
static_assert (NUM_AXIS == 4, "ConfigurationStore M500_conf not implemented for more axis."
"Fix axis_steps_per_unit max_feedrate_normal max_acceleration_units_per_sq_second_normal max_jerk max_feedrate_silent"
"Fix axis_steps_per_mm max_feedrate_normal max_acceleration_units_per_sq_second_normal max_jerk max_feedrate_silent"
" max_acceleration_units_per_sq_second_silent array size.");
#ifdef ENABLE_AUTO_BED_LEVELING
static_assert (false, "zprobe_zoffset was not initialized in printers in field to -(Z_PROBE_OFFSET_FROM_EXTRUDER), so it contains"

View File

@ -9,7 +9,7 @@
typedef struct
{
char version[4];
float axis_steps_per_unit[4];
float axis_steps_per_mm[4];
float max_feedrate_normal[4];
unsigned long max_acceleration_units_per_sq_second_normal[4];
float acceleration; //!< Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX

View File

@ -193,7 +193,7 @@ void dcode_3()
#if 0
extern float current_temperature_pinda;
extern float axis_steps_per_unit[NUM_AXIS];
extern float axis_steps_per_mm[NUM_AXIS];
#define LOG(args...) printf(args)
@ -479,7 +479,7 @@ void dcode_8()
{
uint16_t offs = 0;
if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1));
float foffs = ((float)offs) / cs.axis_steps_per_unit[Z_AXIS];
float foffs = ((float)offs) / cs.axis_steps_per_mm[Z_AXIS];
offs = 1000 * foffs;
printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 5, offs);
}
@ -844,9 +844,9 @@ void dcode_2130()
uint16_t res_new = tmc2130_mres2usteps(mres);
tmc2130_set_res(axis, res_new);
if (res_new > res)
cs.axis_steps_per_unit[axis] *= (res_new / res);
cs.axis_steps_per_mm[axis] *= (res_new / res);
else
cs.axis_steps_per_unit[axis] /= (res / res_new);
cs.axis_steps_per_mm[axis] /= (res / res_new);
}
}
else if (strncmp(strchr_pointer + 7, "wave", 4) == 0)

View File

@ -379,7 +379,7 @@ void PAT9125_sensor::init() {
settings_init(); // also sets the state to State::initializing
calcChunkSteps(cs.axis_steps_per_unit[E_AXIS]); // for jam detection
calcChunkSteps(cs.axis_steps_per_mm[E_AXIS]); // for jam detection
if (!pat9125_init()) {
deinit();

View File

@ -3386,13 +3386,13 @@ void gcode_M114()
SERIAL_PROTOCOL(current_position[E_AXIS]);
SERIAL_PROTOCOLRPGM(_n(" Count X: "));////MSG_COUNT_X
SERIAL_PROTOCOL(float(st_get_position(X_AXIS)) / cs.axis_steps_per_unit[X_AXIS]);
SERIAL_PROTOCOL(float(st_get_position(X_AXIS)) / cs.axis_steps_per_mm[X_AXIS]);
SERIAL_PROTOCOLPGM(" Y:");
SERIAL_PROTOCOL(float(st_get_position(Y_AXIS)) / cs.axis_steps_per_unit[Y_AXIS]);
SERIAL_PROTOCOL(float(st_get_position(Y_AXIS)) / cs.axis_steps_per_mm[Y_AXIS]);
SERIAL_PROTOCOLPGM(" Z:");
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS)) / cs.axis_steps_per_unit[Z_AXIS]);
SERIAL_PROTOCOL(float(st_get_position(Z_AXIS)) / cs.axis_steps_per_mm[Z_AXIS]);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOLLN(float(st_get_position(E_AXIS)) / cs.axis_steps_per_unit[E_AXIS]);
SERIAL_PROTOCOLLN(float(st_get_position(E_AXIS)) / cs.axis_steps_per_mm[E_AXIS]);
}
#if (defined(FANCHECK) && (((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1)))))
@ -3777,7 +3777,7 @@ static void gcode_M861_print_pinda_cal_eeprom() {
for (uint8_t i = 0; i < 6; i++) {
if(i > 0) {
usteps = eeprom_read_word((uint16_t*) EEPROM_PROBE_TEMP_SHIFT + (i - 1));
mm = ((float)usteps) / cs.axis_steps_per_unit[Z_AXIS];
mm = ((float)usteps) / cs.axis_steps_per_mm[Z_AXIS];
SERIAL_PROTOCOL(i - 1);
} else {
SERIAL_PROTOCOLRPGM(MSG_NA);
@ -3885,7 +3885,7 @@ extern uint8_t st_backlash_y;
//! or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
//!@n M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
//!@n M86 - Set safety timer expiration time with parameter S<seconds>; M86 S0 will disable safety timer
//!@n M92 - Set axis_steps_per_unit - same syntax as G92
//!@n M92 - Set axis_steps_per_mm - same syntax as G92
//!@n M104 - Set extruder target temp
//!@n M105 - Read current temp
//!@n M106 - Fan on
@ -4566,7 +4566,7 @@ void process_commands()
// The following code correct the Z height difference from z-probe position and hotend tip position.
// The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
// When the bed is uneven, this height must be corrected.
real_z = float(st_get_position(Z_AXIS))/cs.axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
real_z = float(st_get_position(Z_AXIS))/cs.axis_steps_per_mm[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
z_tmp = current_position[Z_AXIS];
@ -4829,7 +4829,7 @@ void process_commands()
lcd_temp_cal_show_result(find_z_result);
break;
}
z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]);
z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_mm[Z_AXIS]);
printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z);
@ -4914,7 +4914,7 @@ void process_commands()
plan_buffer_line_curposXYZE(3000 / 60);
st_synchronize();
find_bed_induction_sensor_point_z(-1.f);
z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]);
z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_mm[Z_AXIS]);
printf_P(_N("\nTemperature: %d Z shift (mm): %.3f\n"), t_c, current_position[Z_AXIS] - zero_z);
@ -6331,18 +6331,18 @@ Sigma_Exit:
if(i == E_AXIS) { // E
float value = code_value();
if(value < 20.0) {
float factor = cs.axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
float factor = cs.axis_steps_per_mm[i] / value; // increase e constants if M92 E14 is given for netfab.
cs.max_jerk[E_AXIS] *= factor;
max_feedrate[i] *= factor;
max_acceleration_steps_per_s2[i] *= factor;
}
cs.axis_steps_per_unit[i] = value;
cs.axis_steps_per_mm[i] = value;
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
fsensor.init();
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
}
else {
cs.axis_steps_per_unit[i] = code_value();
cs.axis_steps_per_mm[i] = code_value();
}
}
}
@ -6708,7 +6708,7 @@ Sigma_Exit:
#if 0 // Not used for Sprinter/grbl gen6
case 202: // M202
for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * cs.axis_steps_per_unit[i];
if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * cs.axis_steps_per_mm[i];
}
break;
#endif
@ -7720,7 +7720,7 @@ Sigma_Exit:
}
if (code_seen('Z')){
z_val = code_value();
zraw = z_val*cs.axis_steps_per_unit[Z_AXIS];
zraw = z_val*cs.axis_steps_per_mm[Z_AXIS];
if ((zraw < Z_BABYSTEP_MIN) || (zraw > Z_BABYSTEP_MAX))
{
SERIAL_PROTOCOLLNPGM(" Z VALUE OUT OF RANGE");
@ -7731,7 +7731,7 @@ Sigma_Exit:
else
{
zraw = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)));
z_val = ((float)zraw/cs.axis_steps_per_unit[Z_AXIS]);
z_val = ((float)zraw/cs.axis_steps_per_mm[Z_AXIS]);
}
if (code_seen('L'))
@ -8321,13 +8321,13 @@ Sigma_Exit:
if (res_new > res)
{
uint16_t fac = (res_new / res);
cs.axis_steps_per_unit[i] *= fac;
cs.axis_steps_per_mm[i] *= fac;
position[i] *= fac;
}
else
{
uint16_t fac = (res / res_new);
cs.axis_steps_per_unit[i] /= fac;
cs.axis_steps_per_mm[i] /= fac;
position[i] /= fac;
}
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
@ -9387,8 +9387,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
float oldepos=current_position[E_AXIS];
float oldedes=destination[E_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
destination[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/cs.axis_steps_per_unit[E_AXIS],
EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/cs.axis_steps_per_unit[E_AXIS]);
destination[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/cs.axis_steps_per_mm[E_AXIS],
EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/cs.axis_steps_per_mm[E_AXIS]);
current_position[E_AXIS]=oldepos;
destination[E_AXIS]=oldedes;
plan_set_e_position(oldepos);
@ -10209,10 +10209,10 @@ static void temp_compensation_apply() {
if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 60 && target_temperature_bed <= 100) {
i_add = (target_temperature_bed - 60) / 10;
z_shift = eeprom_read_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i_add);
z_shift_mm = z_shift / cs.axis_steps_per_unit[Z_AXIS];
z_shift_mm = z_shift / cs.axis_steps_per_mm[Z_AXIS];
}else {
//interpolation
z_shift_mm = temp_comp_interpolation(target_temperature_bed) / cs.axis_steps_per_unit[Z_AXIS];
z_shift_mm = temp_comp_interpolation(target_temperature_bed) / cs.axis_steps_per_mm[Z_AXIS];
}
printf_P(_N("\nZ shift applied:%.3f\n"), z_shift_mm);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - z_shift_mm, current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40);
@ -10303,7 +10303,7 @@ float temp_compensation_pinda_thermistor_offset(float temperature_pinda)
{
if (!eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE)) return 0;
if (!calibration_status_pinda()) return 0;
return temp_comp_interpolation(temperature_pinda) / cs.axis_steps_per_unit[Z_AXIS];
return temp_comp_interpolation(temperature_pinda) / cs.axis_steps_per_mm[Z_AXIS];
}
#endif //PINDA_THERMISTOR

View File

@ -3055,7 +3055,7 @@ void babystep_load()
SERIAL_ECHO(", current Z: ");
SERIAL_ECHO(current_position[Z_AXIS]);
SERIAL_ECHO("correction: ");
SERIAL_ECHO(float(babystepLoadZ) / float(axis_steps_per_unit[Z_AXIS]));
SERIAL_ECHO(float(babystepLoadZ) / float(axis_steps_per_mm[Z_AXIS]));
SERIAL_ECHOLN("");
#endif
}
@ -3064,12 +3064,12 @@ void babystep_load()
void babystep_apply()
{
babystep_load();
shift_z(- float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS]));
shift_z(- float(babystepLoadZ) / float(cs.axis_steps_per_mm[Z_AXIS]));
}
void babystep_undo()
{
shift_z(float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS]));
shift_z(float(babystepLoadZ) / float(cs.axis_steps_per_mm[Z_AXIS]));
babystepLoadZ = 0;
}

View File

@ -94,7 +94,7 @@ matrix_3x3 plan_bed_level_matrix = {
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps
long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode
long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_mm are changed by gcode
static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment
static float previous_safe_speed; // Exit speed limited by a jerk to full halt of a previous last segment.
@ -628,9 +628,9 @@ void planner_reset_position()
else {
float t = float(step_events_completed) / float(current_block->step_event_count);
float vec[3] = {
current_block->steps_x / cs.axis_steps_per_unit[X_AXIS],
current_block->steps_y / cs.axis_steps_per_unit[Y_AXIS],
current_block->steps_z / cs.axis_steps_per_unit[Z_AXIS]
current_block->steps_x / cs.axis_steps_per_mm[X_AXIS],
current_block->steps_y / cs.axis_steps_per_mm[Y_AXIS],
current_block->steps_z / cs.axis_steps_per_mm[Z_AXIS]
};
float pos1[3], pos2[3];
for (int8_t i = 0; i < 3; ++ i) {
@ -809,18 +809,18 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
// Calculate target position in absolute steps
//this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
long target[4];
target[X_AXIS] = lround(x*cs.axis_steps_per_unit[X_AXIS]);
target[Y_AXIS] = lround(y*cs.axis_steps_per_unit[Y_AXIS]);
target[X_AXIS] = lround(x*cs.axis_steps_per_mm[X_AXIS]);
target[Y_AXIS] = lround(y*cs.axis_steps_per_mm[Y_AXIS]);
#ifdef MESH_BED_LEVELING
if (mbl.active){
target[Z_AXIS] = lround((z+mbl.get_z(x, y))*cs.axis_steps_per_unit[Z_AXIS]);
target[Z_AXIS] = lround((z+mbl.get_z(x, y))*cs.axis_steps_per_mm[Z_AXIS]);
}else{
target[Z_AXIS] = lround(z*cs.axis_steps_per_unit[Z_AXIS]);
target[Z_AXIS] = lround(z*cs.axis_steps_per_mm[Z_AXIS]);
}
#else
target[Z_AXIS] = lround(z*cs.axis_steps_per_unit[Z_AXIS]);
target[Z_AXIS] = lround(z*cs.axis_steps_per_mm[Z_AXIS]);
#endif // ENABLE_MESH_BED_LEVELING
target[E_AXIS] = lround(e*cs.axis_steps_per_unit[E_AXIS]);
target[E_AXIS] = lround(e*cs.axis_steps_per_mm[E_AXIS]);
// Calculate subtraction to re-use result in many places
// This saves memory and speeds up calculations
@ -844,7 +844,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
}
#ifdef PREVENT_LENGTHY_EXTRUDE
if(labs(de) > cs.axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH)
if(labs(de) > cs.axis_steps_per_mm[E_AXIS]*EXTRUDE_MAXLENGTH)
{
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
#ifdef LIN_ADVANCE
@ -928,17 +928,17 @@ Having the real displacement of the head, we can calculate the total movement le
*/
#ifndef COREXY
float delta_mm[4];
delta_mm[X_AXIS] = dx / cs.axis_steps_per_unit[X_AXIS];
delta_mm[Y_AXIS] = dy / cs.axis_steps_per_unit[Y_AXIS];
delta_mm[X_AXIS] = dx / cs.axis_steps_per_mm[X_AXIS];
delta_mm[Y_AXIS] = dy / cs.axis_steps_per_mm[Y_AXIS];
#else
float delta_mm[6];
delta_mm[X_HEAD] = dx / cs.axis_steps_per_unit[X_AXIS];
delta_mm[Y_HEAD] = dy / cs.axis_steps_per_unit[Y_AXIS];
delta_mm[X_AXIS] = (dx + dy) / cs.axis_steps_per_unit[X_AXIS];
delta_mm[Y_AXIS] = (dx - dy) / cs.axis_steps_per_unit[Y_AXIS];
delta_mm[X_HEAD] = dx / cs.axis_steps_per_mm[X_AXIS];
delta_mm[Y_HEAD] = dy / cs.axis_steps_per_mm[Y_AXIS];
delta_mm[X_AXIS] = (dx + dy) / cs.axis_steps_per_mm[X_AXIS];
delta_mm[Y_AXIS] = (dx - dy) / cs.axis_steps_per_mm[Y_AXIS];
#endif
delta_mm[Z_AXIS] = dz / cs.axis_steps_per_unit[Z_AXIS];
delta_mm[E_AXIS] = de / cs.axis_steps_per_unit[E_AXIS];
delta_mm[Z_AXIS] = dz / cs.axis_steps_per_mm[Z_AXIS];
delta_mm[E_AXIS] = de / cs.axis_steps_per_mm[E_AXIS];
if ( block->steps[X_AXIS].wide <=dropsegments && block->steps[Y_AXIS].wide <=dropsegments && block->steps[Z_AXIS].wide <=dropsegments )
{
block->millimeters = fabs(delta_mm[E_AXIS]);
@ -1206,14 +1206,14 @@ Having the real displacement of the head, we can calculate the total movement le
if (block->use_advance_lead) {
// calculate the compression ratio for the segment (the required advance steps are computed
// during trapezoid planning)
float adv_comp = extruder_advance_K * e_D_ratio * cs.axis_steps_per_unit[E_AXIS]; // (step/(mm/s))
float adv_comp = extruder_advance_K * e_D_ratio * cs.axis_steps_per_mm[E_AXIS]; // (step/(mm/s))
block->adv_comp = adv_comp / block->speed_factor; // step/(step/min)
float advance_speed;
if (e_D_ratio > 0)
advance_speed = (extruder_advance_K * e_D_ratio * block->acceleration * cs.axis_steps_per_unit[E_AXIS]);
advance_speed = (extruder_advance_K * e_D_ratio * block->acceleration * cs.axis_steps_per_mm[E_AXIS]);
else
advance_speed = cs.max_jerk[E_AXIS] * cs.axis_steps_per_unit[E_AXIS];
advance_speed = cs.max_jerk[E_AXIS] * cs.axis_steps_per_mm[E_AXIS];
// to save more space we avoid another copy of calc_timer and go through slow division, but we
// still need to replicate the *exact* same step grouping policy (see below)
@ -1314,16 +1314,16 @@ void plan_set_position(float x, float y, float z, const float &e)
world2machine(x, y);
position[X_AXIS] = lround(x*cs.axis_steps_per_unit[X_AXIS]);
position[Y_AXIS] = lround(y*cs.axis_steps_per_unit[Y_AXIS]);
position[X_AXIS] = lround(x*cs.axis_steps_per_mm[X_AXIS]);
position[Y_AXIS] = lround(y*cs.axis_steps_per_mm[Y_AXIS]);
#ifdef MESH_BED_LEVELING
position[Z_AXIS] = mbl.active ?
lround((z+mbl.get_z(x, y))*cs.axis_steps_per_unit[Z_AXIS]) :
lround(z*cs.axis_steps_per_unit[Z_AXIS]);
lround((z+mbl.get_z(x, y))*cs.axis_steps_per_mm[Z_AXIS]) :
lround(z*cs.axis_steps_per_mm[Z_AXIS]);
#else
position[Z_AXIS] = lround(z*cs.axis_steps_per_unit[Z_AXIS]);
position[Z_AXIS] = lround(z*cs.axis_steps_per_mm[Z_AXIS]);
#endif // ENABLE_MESH_BED_LEVELING
position[E_AXIS] = lround(e*cs.axis_steps_per_unit[E_AXIS]);
position[E_AXIS] = lround(e*cs.axis_steps_per_mm[E_AXIS]);
#ifdef LIN_ADVANCE
position_float[X_AXIS] = x;
position_float[Y_AXIS] = y;
@ -1341,7 +1341,7 @@ void plan_set_z_position(const float &z)
#ifdef LIN_ADVANCE
position_float[Z_AXIS] = z;
#endif
position[Z_AXIS] = lround(z*cs.axis_steps_per_unit[Z_AXIS]);
position[Z_AXIS] = lround(z*cs.axis_steps_per_mm[Z_AXIS]);
st_set_position(position);
}
@ -1350,7 +1350,7 @@ void plan_set_e_position(const float &e)
#ifdef LIN_ADVANCE
position_float[E_AXIS] = e;
#endif
position[E_AXIS] = lround(e*cs.axis_steps_per_unit[E_AXIS]);
position[E_AXIS] = lround(e*cs.axis_steps_per_mm[E_AXIS]);
st_set_e_position(position[E_AXIS]);
}
@ -1370,7 +1370,7 @@ void set_extrude_min_temp(int temp)
void reset_acceleration_rates()
{
for(int8_t i=0; i < NUM_AXIS; i++)
max_acceleration_steps_per_s2[i] = max_acceleration_units_per_sq_second[i] * cs.axis_steps_per_unit[i];
max_acceleration_steps_per_s2[i] = max_acceleration_units_per_sq_second[i] * cs.axis_steps_per_mm[i];
}
#ifdef TMC2130

View File

@ -146,7 +146,7 @@ void uvlo_() {
uint16_t z_res = tmc2130_get_res(Z_AXIS);
uint16_t z_microsteps = tmc2130_rd_MSCNT(Z_AXIS);
current_position[Z_AXIS] += float(1024 - z_microsteps)
/ (z_res * cs.axis_steps_per_unit[Z_AXIS])
/ (z_res * cs.axis_steps_per_mm[Z_AXIS])
+ UVLO_Z_AXIS_SHIFT;
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60);
st_synchronize();
@ -244,7 +244,7 @@ static void uvlo_tiny() {
planner_abort_hard();
// Allow for small roundoffs to be ignored
if(fabs(current_position[Z_AXIS] - eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z))) >= 1.f/cs.axis_steps_per_unit[Z_AXIS])
if(fabs(current_position[Z_AXIS] - eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z))) >= 1.f/cs.axis_steps_per_mm[Z_AXIS])
{
// Clean the input command queue, inhibit serial processing using saved_printing
cmdqueue_reset();
@ -260,7 +260,7 @@ static void uvlo_tiny() {
uint16_t z_res = tmc2130_get_res(Z_AXIS);
uint16_t z_microsteps = tmc2130_rd_MSCNT(Z_AXIS);
current_position[Z_AXIS] += float(1024 - z_microsteps)
/ (z_res * cs.axis_steps_per_unit[Z_AXIS])
/ (z_res * cs.axis_steps_per_mm[Z_AXIS])
+ UVLO_TINY_Z_AXIS_SHIFT;
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60);
st_synchronize();

View File

@ -192,15 +192,15 @@ void checkHitEndstops()
SERIAL_ECHO_START;
SERIAL_ECHORPGM(MSG_ENDSTOPS_HIT);
if(endstop_hit & _BV(X_AXIS)) {
SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/cs.axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/cs.axis_steps_per_mm[X_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT), PSTR("X")));
}
if(endstop_hit & _BV(Y_AXIS)) {
SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/cs.axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/cs.axis_steps_per_mm[Y_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT), PSTR("Y")));
}
if(endstop_hit & _BV(Z_AXIS)) {
SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/cs.axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/cs.axis_steps_per_mm[Z_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT),PSTR("Z")));
}
SERIAL_ECHOLN("");
@ -1348,7 +1348,7 @@ void st_get_position_xy(long &x, long &y)
float st_get_position_mm(uint8_t axis)
{
float steper_position_in_steps = st_get_position(axis);
return steper_position_in_steps / cs.axis_steps_per_unit[axis];
return steper_position_in_steps / cs.axis_steps_per_mm[axis];
}

View File

@ -2562,7 +2562,7 @@ static void lcd_babystep_z()
if (!calibration_status_get(CALIBRATION_STATUS_LIVE_ADJUST))
_md->babystepMemZ = 0;
_md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS];
_md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_mm[Z_AXIS];
lcd_draw_update = 1;
//SERIAL_ECHO("Z baby step: ");
//SERIAL_ECHO(_md->babystepMem[2]);
@ -2576,7 +2576,7 @@ static void lcd_babystep_z()
else if (_md->babystepMemZ > Z_BABYSTEP_MAX) _md->babystepMemZ = Z_BABYSTEP_MAX; //0
else babystepsTodoZadd(lcd_encoder);
_md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS];
_md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_mm[Z_AXIS];
_delay(50);
lcd_encoder = 0;
lcd_draw_update = 1;
@ -3572,7 +3572,7 @@ void lcd_first_layer_calibration_reset()
char sheet_name[sizeof(Sheet::name)];
eeprom_read_block(sheet_name, &EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name));
lcd_set_cursor(0, 0);
float offset = static_cast<int16_t>(eeprom_read_word(reinterpret_cast<uint16_t*>(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_unit[Z_AXIS];
float offset = static_cast<int16_t>(eeprom_read_word(reinterpret_cast<uint16_t*>(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_mm[Z_AXIS];
lcd_printf_P(_i("Sheet %.7s\nZ offset: %+1.3fmm\n%cContinue\n%cReset"),////MSG_SHEET_OFFSET c=20 r=4
sheet_name, offset, menuData->reset ? ' ' : '>', menuData->reset ? '>' : ' ');// \n denotes line break, %.7s is replaced by 7 character long sheet name, %+1.3f is replaced by 6 character long floating point number, %c is replaced by > or white space (one character) based on whether first or second option is selected. % denoted place holders can not be reordered.