Use code_value_linear_units for known-linear axes
This commit is contained in:
parent
b956f2642b
commit
69dfa54a84
@ -1285,19 +1285,19 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() >
|
|||||||
volumetric_unit_factor = pow(linear_unit_factor, 3.0);
|
volumetric_unit_factor = pow(linear_unit_factor, 3.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float axis_unit_factor(int axis) {
|
inline float axis_unit_factor(const AxisEnum axis) {
|
||||||
return (axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor);
|
return (axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
|
inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
|
||||||
inline float code_value_axis_units(int axis) { return code_value_float() * axis_unit_factor(axis); }
|
inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
|
||||||
inline float code_value_per_axis_unit(int axis) { return code_value_float() / axis_unit_factor(axis); }
|
inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline float code_value_linear_units() { return code_value_float(); }
|
#define code_value_linear_units() code_value_float()
|
||||||
inline float code_value_axis_units(int axis) { UNUSED(axis); return code_value_float(); }
|
#define code_value_axis_units(A) code_value_float()
|
||||||
inline float code_value_per_axis_unit(int axis) { UNUSED(axis); return code_value_float(); }
|
#define code_value_per_axis_unit(A) code_value_float()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3063,7 +3063,7 @@ static void homeaxis(const AxisEnum axis) {
|
|||||||
void gcode_get_destination() {
|
void gcode_get_destination() {
|
||||||
LOOP_XYZE(i) {
|
LOOP_XYZE(i) {
|
||||||
if (code_seen(axis_codes[i]))
|
if (code_seen(axis_codes[i]))
|
||||||
destination[i] = code_value_axis_units(i) + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
|
destination[i] = code_value_axis_units((AxisEnum)i) + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
|
||||||
else
|
else
|
||||||
destination[i] = current_position[i];
|
destination[i] = current_position[i];
|
||||||
}
|
}
|
||||||
@ -3232,7 +3232,7 @@ inline void gcode_G0_G1(
|
|||||||
|
|
||||||
float arc_offset[2] = { 0.0, 0.0 };
|
float arc_offset[2] = { 0.0, 0.0 };
|
||||||
if (code_seen('R')) {
|
if (code_seen('R')) {
|
||||||
const float r = code_value_axis_units(X_AXIS),
|
const float r = code_value_linear_units(),
|
||||||
x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS],
|
x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS],
|
||||||
x2 = destination[X_AXIS], y2 = destination[Y_AXIS];
|
x2 = destination[X_AXIS], y2 = destination[Y_AXIS];
|
||||||
if (r && (x2 != x1 || y2 != y1)) {
|
if (r && (x2 != x1 || y2 != y1)) {
|
||||||
@ -3248,8 +3248,8 @@ inline void gcode_G0_G1(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (code_seen('I')) arc_offset[X_AXIS] = code_value_axis_units(X_AXIS);
|
if (code_seen('I')) arc_offset[X_AXIS] = code_value_linear_units();
|
||||||
if (code_seen('J')) arc_offset[Y_AXIS] = code_value_axis_units(Y_AXIS);
|
if (code_seen('J')) arc_offset[Y_AXIS] = code_value_linear_units();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arc_offset[0] || arc_offset[1]) {
|
if (arc_offset[0] || arc_offset[1]) {
|
||||||
@ -3302,10 +3302,10 @@ inline void gcode_G4() {
|
|||||||
gcode_get_destination();
|
gcode_get_destination();
|
||||||
|
|
||||||
const float offset[] = {
|
const float offset[] = {
|
||||||
code_seen('I') ? code_value_axis_units(X_AXIS) : 0.0,
|
code_seen('I') ? code_value_linear_units() : 0.0,
|
||||||
code_seen('J') ? code_value_axis_units(Y_AXIS) : 0.0,
|
code_seen('J') ? code_value_linear_units() : 0.0,
|
||||||
code_seen('P') ? code_value_axis_units(X_AXIS) : 0.0,
|
code_seen('P') ? code_value_linear_units() : 0.0,
|
||||||
code_seen('Q') ? code_value_axis_units(Y_AXIS) : 0.0
|
code_seen('Q') ? code_value_linear_units() : 0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
plan_cubic_move(offset);
|
plan_cubic_move(offset);
|
||||||
@ -4023,7 +4023,7 @@ inline void gcode_G28() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (code_seen('Z')) {
|
if (code_seen('Z')) {
|
||||||
mbl.z_values[px][py] = code_value_axis_units(Z_AXIS);
|
mbl.z_values[px][py] = code_value_linear_units();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SERIAL_CHAR('Z'); say_not_entered();
|
SERIAL_CHAR('Z'); say_not_entered();
|
||||||
@ -4033,7 +4033,7 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
case MeshSetZOffset:
|
case MeshSetZOffset:
|
||||||
if (code_seen('Z')) {
|
if (code_seen('Z')) {
|
||||||
mbl.z_offset = code_value_axis_units(Z_AXIS);
|
mbl.z_offset = code_value_linear_units();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SERIAL_CHAR('Z'); say_not_entered();
|
SERIAL_CHAR('Z'); say_not_entered();
|
||||||
@ -4305,7 +4305,7 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
|
|
||||||
zoffset = code_seen('Z') ? code_value_axis_units(Z_AXIS) : 0;
|
zoffset = code_seen('Z') ? code_value_linear_units() : 0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4313,10 +4313,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(code_seen('S') ? code_value_linear_units() : XY_PROBE_SPEED);
|
xy_probe_feedrate_mm_s = MMM_TO_MMS(code_seen('S') ? code_value_linear_units() : XY_PROBE_SPEED);
|
||||||
|
|
||||||
left_probe_bed_position = code_seen('L') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(LEFT_PROBE_BED_POSITION);
|
left_probe_bed_position = code_seen('L') ? (int)code_value_linear_units() : LOGICAL_X_POSITION(LEFT_PROBE_BED_POSITION);
|
||||||
right_probe_bed_position = code_seen('R') ? (int)code_value_axis_units(X_AXIS) : LOGICAL_X_POSITION(RIGHT_PROBE_BED_POSITION);
|
right_probe_bed_position = code_seen('R') ? (int)code_value_linear_units() : LOGICAL_X_POSITION(RIGHT_PROBE_BED_POSITION);
|
||||||
front_probe_bed_position = code_seen('F') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(FRONT_PROBE_BED_POSITION);
|
front_probe_bed_position = code_seen('F') ? (int)code_value_linear_units() : LOGICAL_Y_POSITION(FRONT_PROBE_BED_POSITION);
|
||||||
back_probe_bed_position = code_seen('B') ? (int)code_value_axis_units(Y_AXIS) : LOGICAL_Y_POSITION(BACK_PROBE_BED_POSITION);
|
back_probe_bed_position = code_seen('B') ? (int)code_value_linear_units() : LOGICAL_Y_POSITION(BACK_PROBE_BED_POSITION);
|
||||||
|
|
||||||
const bool left_out_l = left_probe_bed_position < LOGICAL_X_POSITION(MIN_PROBE_X),
|
const bool left_out_l = left_probe_bed_position < LOGICAL_X_POSITION(MIN_PROBE_X),
|
||||||
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE),
|
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE),
|
||||||
@ -4927,8 +4927,8 @@ inline void gcode_G28() {
|
|||||||
* S = Stows the probe if 1 (default=1)
|
* S = Stows the probe if 1 (default=1)
|
||||||
*/
|
*/
|
||||||
inline void gcode_G30() {
|
inline void gcode_G30() {
|
||||||
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
float X_probe_location = code_seen('X') ? code_value_linear_units() : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
||||||
Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
Y_probe_location = code_seen('Y') ? code_value_linear_units() : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
||||||
|
|
||||||
float pos[XYZ] = { X_probe_location, Y_probe_location, LOGICAL_Z_POSITION(0) };
|
float pos[XYZ] = { X_probe_location, Y_probe_location, LOGICAL_Z_POSITION(0) };
|
||||||
if (!position_is_reachable(pos, true)) return;
|
if (!position_is_reachable(pos, true)) return;
|
||||||
@ -5431,13 +5431,13 @@ inline void gcode_G92() {
|
|||||||
LOOP_XYZE(i) {
|
LOOP_XYZE(i) {
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
#if IS_SCARA
|
#if IS_SCARA
|
||||||
current_position[i] = code_value_axis_units(i);
|
current_position[i] = code_value_axis_units((AxisEnum)i);
|
||||||
if (i != E_AXIS) didXYZ = true;
|
if (i != E_AXIS) didXYZ = true;
|
||||||
#else
|
#else
|
||||||
#if HAS_POSITION_SHIFT
|
#if HAS_POSITION_SHIFT
|
||||||
float p = current_position[i];
|
const float p = current_position[i];
|
||||||
#endif
|
#endif
|
||||||
float v = code_value_axis_units(i);
|
float v = code_value_axis_units((AxisEnum)i);
|
||||||
|
|
||||||
current_position[i] = v;
|
current_position[i] = v;
|
||||||
|
|
||||||
@ -6078,7 +6078,7 @@ inline void gcode_M42() {
|
|||||||
|
|
||||||
bool stow_probe_after_each = code_seen('E');
|
bool stow_probe_after_each = code_seen('E');
|
||||||
|
|
||||||
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
float X_probe_location = code_seen('X') ? code_value_linear_units() : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
||||||
#if DISABLED(DELTA)
|
#if DISABLED(DELTA)
|
||||||
if (!WITHIN(X_probe_location, LOGICAL_X_POSITION(MIN_PROBE_X), LOGICAL_X_POSITION(MAX_PROBE_X))) {
|
if (!WITHIN(X_probe_location, LOGICAL_X_POSITION(MIN_PROBE_X), LOGICAL_X_POSITION(MAX_PROBE_X))) {
|
||||||
out_of_range_error(PSTR("X"));
|
out_of_range_error(PSTR("X"));
|
||||||
@ -6086,7 +6086,7 @@ inline void gcode_M42() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
float Y_probe_location = code_seen('Y') ? code_value_linear_units() : Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
||||||
#if DISABLED(DELTA)
|
#if DISABLED(DELTA)
|
||||||
if (!WITHIN(Y_probe_location, LOGICAL_Y_POSITION(MIN_PROBE_Y), LOGICAL_Y_POSITION(MAX_PROBE_Y))) {
|
if (!WITHIN(Y_probe_location, LOGICAL_Y_POSITION(MIN_PROBE_Y), LOGICAL_Y_POSITION(MAX_PROBE_Y))) {
|
||||||
out_of_range_error(PSTR("Y"));
|
out_of_range_error(PSTR("Y"));
|
||||||
@ -7063,7 +7063,7 @@ inline void gcode_M92() {
|
|||||||
LOOP_XYZE(i) {
|
LOOP_XYZE(i) {
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
if (i == E_AXIS) {
|
if (i == E_AXIS) {
|
||||||
float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER);
|
const float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER);
|
||||||
if (value < 20.0) {
|
if (value < 20.0) {
|
||||||
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
||||||
planner.max_jerk[E_AXIS] *= factor;
|
planner.max_jerk[E_AXIS] *= factor;
|
||||||
@ -7250,7 +7250,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
|||||||
RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
|
RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
|
||||||
|
|
||||||
// Lift Z axis
|
// Lift Z axis
|
||||||
const float z_lift = code_seen('Z') ? code_value_axis_units(Z_AXIS) :
|
const float z_lift = code_seen('Z') ? code_value_linear_units() :
|
||||||
#if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
|
#if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
|
||||||
FILAMENT_CHANGE_Z_ADD
|
FILAMENT_CHANGE_Z_ADD
|
||||||
#else
|
#else
|
||||||
@ -7264,12 +7264,12 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move XY axes to filament change position or given position
|
// Move XY axes to filament change position or given position
|
||||||
destination[X_AXIS] = code_seen('X') ? code_value_axis_units(X_AXIS) : 0
|
destination[X_AXIS] = code_seen('X') ? code_value_linear_units() : 0
|
||||||
#ifdef FILAMENT_CHANGE_X_POS
|
#ifdef FILAMENT_CHANGE_X_POS
|
||||||
+ FILAMENT_CHANGE_X_POS
|
+ FILAMENT_CHANGE_X_POS
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
destination[Y_AXIS] = code_seen('Y') ? code_value_axis_units(Y_AXIS) : 0
|
destination[Y_AXIS] = code_seen('Y') ? code_value_linear_units() : 0
|
||||||
#ifdef FILAMENT_CHANGE_Y_POS
|
#ifdef FILAMENT_CHANGE_Y_POS
|
||||||
+ FILAMENT_CHANGE_Y_POS
|
+ FILAMENT_CHANGE_Y_POS
|
||||||
#endif
|
#endif
|
||||||
@ -7355,10 +7355,6 @@ inline void gcode_M200() {
|
|||||||
if (! filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
if (! filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
//reserved for setting filament diameter via UFID or filament measuring device
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
calculate_volumetric_multipliers();
|
calculate_volumetric_multipliers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7374,7 +7370,7 @@ inline void gcode_M201() {
|
|||||||
LOOP_XYZE(i) {
|
LOOP_XYZE(i) {
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
||||||
planner.max_acceleration_mm_per_s2[a] = code_value_axis_units(a);
|
planner.max_acceleration_mm_per_s2[a] = code_value_axis_units((AxisEnum)a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
||||||
@ -7384,7 +7380,7 @@ inline void gcode_M201() {
|
|||||||
#if 0 // Not used for Sprinter/grbl gen6
|
#if 0 // Not used for Sprinter/grbl gen6
|
||||||
inline void gcode_M202() {
|
inline void gcode_M202() {
|
||||||
LOOP_XYZE(i) {
|
LOOP_XYZE(i) {
|
||||||
if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value_axis_units(i) * planner.axis_steps_per_mm[i];
|
if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value_axis_units((AxisEnum)i) * planner.axis_steps_per_mm[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -7402,7 +7398,7 @@ inline void gcode_M203() {
|
|||||||
LOOP_XYZE(i)
|
LOOP_XYZE(i)
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
|
||||||
planner.max_feedrate_mm_s[a] = code_value_axis_units(a);
|
planner.max_feedrate_mm_s[a] = code_value_axis_units((AxisEnum)a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7449,10 +7445,10 @@ inline void gcode_M205() {
|
|||||||
if (code_seen('S')) planner.min_feedrate_mm_s = code_value_linear_units();
|
if (code_seen('S')) planner.min_feedrate_mm_s = code_value_linear_units();
|
||||||
if (code_seen('T')) planner.min_travel_feedrate_mm_s = code_value_linear_units();
|
if (code_seen('T')) planner.min_travel_feedrate_mm_s = code_value_linear_units();
|
||||||
if (code_seen('B')) planner.min_segment_time = code_value_millis();
|
if (code_seen('B')) planner.min_segment_time = code_value_millis();
|
||||||
if (code_seen('X')) planner.max_jerk[X_AXIS] = code_value_axis_units(X_AXIS);
|
if (code_seen('X')) planner.max_jerk[X_AXIS] = code_value_linear_units();
|
||||||
if (code_seen('Y')) planner.max_jerk[Y_AXIS] = code_value_axis_units(Y_AXIS);
|
if (code_seen('Y')) planner.max_jerk[Y_AXIS] = code_value_linear_units();
|
||||||
if (code_seen('Z')) planner.max_jerk[Z_AXIS] = code_value_axis_units(Z_AXIS);
|
if (code_seen('Z')) planner.max_jerk[Z_AXIS] = code_value_linear_units();
|
||||||
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_axis_units(E_AXIS);
|
if (code_seen('E')) planner.max_jerk[E_AXIS] = code_value_linear_units();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_M206_COMMAND
|
#if HAS_M206_COMMAND
|
||||||
@ -7463,11 +7459,11 @@ inline void gcode_M205() {
|
|||||||
inline void gcode_M206() {
|
inline void gcode_M206() {
|
||||||
LOOP_XYZ(i)
|
LOOP_XYZ(i)
|
||||||
if (code_seen(axis_codes[i]))
|
if (code_seen(axis_codes[i]))
|
||||||
set_home_offset((AxisEnum)i, code_value_axis_units(i));
|
set_home_offset((AxisEnum)i, code_value_linear_units());
|
||||||
|
|
||||||
#if ENABLED(MORGAN_SCARA)
|
#if ENABLED(MORGAN_SCARA)
|
||||||
if (code_seen('T')) set_home_offset(A_AXIS, code_value_axis_units(A_AXIS)); // Theta
|
if (code_seen('T')) set_home_offset(A_AXIS, code_value_linear_units()); // Theta
|
||||||
if (code_seen('P')) set_home_offset(B_AXIS, code_value_axis_units(B_AXIS)); // Psi
|
if (code_seen('P')) set_home_offset(B_AXIS, code_value_linear_units()); // Psi
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SYNC_PLAN_POSITION_KINEMATIC();
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
@ -7517,7 +7513,7 @@ inline void gcode_M205() {
|
|||||||
#endif
|
#endif
|
||||||
LOOP_XYZ(i) {
|
LOOP_XYZ(i) {
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
endstop_adj[i] = code_value_axis_units(i);
|
endstop_adj[i] = code_value_linear_units();
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
SERIAL_ECHOPAIR("endstop_adj[", axis_codes[i]);
|
SERIAL_ECHOPAIR("endstop_adj[", axis_codes[i]);
|
||||||
@ -7539,7 +7535,7 @@ inline void gcode_M205() {
|
|||||||
* M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
|
* M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
|
||||||
*/
|
*/
|
||||||
inline void gcode_M666() {
|
inline void gcode_M666() {
|
||||||
if (code_seen('Z')) z_endstop_adj = code_value_axis_units(Z_AXIS);
|
if (code_seen('Z')) z_endstop_adj = code_value_linear_units();
|
||||||
SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
|
SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7558,7 +7554,7 @@ inline void gcode_M205() {
|
|||||||
inline void gcode_M207() {
|
inline void gcode_M207() {
|
||||||
if (code_seen('S')) retract_length = code_value_axis_units(E_AXIS);
|
if (code_seen('S')) retract_length = code_value_axis_units(E_AXIS);
|
||||||
if (code_seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(code_value_axis_units(E_AXIS));
|
if (code_seen('F')) retract_feedrate_mm_s = MMM_TO_MMS(code_value_axis_units(E_AXIS));
|
||||||
if (code_seen('Z')) retract_zlift = code_value_axis_units(Z_AXIS);
|
if (code_seen('Z')) retract_zlift = code_value_linear_units();
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
if (code_seen('W')) retract_length_swap = code_value_axis_units(E_AXIS);
|
if (code_seen('W')) retract_length_swap = code_value_axis_units(E_AXIS);
|
||||||
#endif
|
#endif
|
||||||
@ -7631,11 +7627,11 @@ inline void gcode_M211() {
|
|||||||
inline void gcode_M218() {
|
inline void gcode_M218() {
|
||||||
if (get_target_extruder_from_command(218) || target_extruder == 0) return;
|
if (get_target_extruder_from_command(218) || target_extruder == 0) return;
|
||||||
|
|
||||||
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_axis_units(X_AXIS);
|
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_linear_units();
|
||||||
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_axis_units(Y_AXIS);
|
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_linear_units();
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER)
|
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER)
|
||||||
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value_axis_units(Z_AXIS);
|
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value_linear_units();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
@ -8285,11 +8281,11 @@ void quickstop_stepper() {
|
|||||||
int8_t px = 0, py = 0;
|
int8_t px = 0, py = 0;
|
||||||
float z = 0;
|
float z = 0;
|
||||||
bool hasX, hasY, hasZ, hasI, hasJ;
|
bool hasX, hasY, hasZ, hasI, hasJ;
|
||||||
if ((hasX = code_seen('X'))) px = mbl.probe_index_x(code_value_axis_units(X_AXIS));
|
if ((hasX = code_seen('X'))) px = mbl.probe_index_x(code_value_linear_units());
|
||||||
if ((hasY = code_seen('Y'))) py = mbl.probe_index_y(code_value_axis_units(Y_AXIS));
|
if ((hasY = code_seen('Y'))) py = mbl.probe_index_y(code_value_linear_units());
|
||||||
if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
|
if ((hasI = code_seen('I'))) px = code_value_linear_units();
|
||||||
if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
|
if ((hasJ = code_seen('J'))) py = code_value_linear_units();
|
||||||
if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
|
if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
|
||||||
|
|
||||||
if (hasX && hasY && hasZ) {
|
if (hasX && hasY && hasZ) {
|
||||||
|
|
||||||
@ -8325,9 +8321,9 @@ void quickstop_stepper() {
|
|||||||
int8_t px = 0, py = 0;
|
int8_t px = 0, py = 0;
|
||||||
float z = 0;
|
float z = 0;
|
||||||
bool hasI, hasJ, hasZ;
|
bool hasI, hasJ, hasZ;
|
||||||
if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
|
if ((hasI = code_seen('I'))) px = code_value_linear_units();
|
||||||
if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
|
if ((hasJ = code_seen('J'))) py = code_value_linear_units();
|
||||||
if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
|
if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
|
||||||
|
|
||||||
if (hasI && hasJ && hasZ) {
|
if (hasI && hasJ && hasZ) {
|
||||||
if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_X - 1)) {
|
if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_X - 1)) {
|
||||||
@ -8474,7 +8470,7 @@ inline void gcode_M503() {
|
|||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPGM(MSG_ZPROBE_ZOFFSET " ");
|
SERIAL_ECHOPGM(MSG_ZPROBE_ZOFFSET " ");
|
||||||
if (code_seen('Z')) {
|
if (code_seen('Z')) {
|
||||||
const float value = code_value_axis_units(Z_AXIS);
|
const float value = code_value_linear_units();
|
||||||
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
||||||
zprobe_zoffset = value;
|
zprobe_zoffset = value;
|
||||||
refresh_zprobe_zoffset();
|
refresh_zprobe_zoffset();
|
||||||
@ -8557,7 +8553,7 @@ inline void gcode_M503() {
|
|||||||
RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
|
RUNPLAN(FILAMENT_CHANGE_RETRACT_FEEDRATE);
|
||||||
|
|
||||||
// Lift Z axis
|
// Lift Z axis
|
||||||
float z_lift = code_seen('Z') ? code_value_axis_units(Z_AXIS) :
|
float z_lift = code_seen('Z') ? code_value_linear_units() :
|
||||||
#if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
|
#if defined(FILAMENT_CHANGE_Z_ADD) && FILAMENT_CHANGE_Z_ADD > 0
|
||||||
FILAMENT_CHANGE_Z_ADD
|
FILAMENT_CHANGE_Z_ADD
|
||||||
#else
|
#else
|
||||||
@ -8572,12 +8568,12 @@ inline void gcode_M503() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move XY axes to filament exchange position
|
// Move XY axes to filament exchange position
|
||||||
if (code_seen('X')) destination[X_AXIS] = code_value_axis_units(X_AXIS);
|
if (code_seen('X')) destination[X_AXIS] = code_value_linear_units();
|
||||||
#ifdef FILAMENT_CHANGE_X_POS
|
#ifdef FILAMENT_CHANGE_X_POS
|
||||||
else destination[X_AXIS] = FILAMENT_CHANGE_X_POS;
|
else destination[X_AXIS] = FILAMENT_CHANGE_X_POS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (code_seen('Y')) destination[Y_AXIS] = code_value_axis_units(Y_AXIS);
|
if (code_seen('Y')) destination[Y_AXIS] = code_value_linear_units();
|
||||||
#ifdef FILAMENT_CHANGE_Y_POS
|
#ifdef FILAMENT_CHANGE_Y_POS
|
||||||
else destination[Y_AXIS] = FILAMENT_CHANGE_Y_POS;
|
else destination[Y_AXIS] = FILAMENT_CHANGE_Y_POS;
|
||||||
#endif
|
#endif
|
||||||
@ -8766,7 +8762,7 @@ inline void gcode_M503() {
|
|||||||
case DXC_AUTO_PARK_MODE:
|
case DXC_AUTO_PARK_MODE:
|
||||||
break;
|
break;
|
||||||
case DXC_DUPLICATION_MODE:
|
case DXC_DUPLICATION_MODE:
|
||||||
if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_axis_units(X_AXIS), X2_MIN_POS - x_home_pos(0));
|
if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_linear_units(), X2_MIN_POS - x_home_pos(0));
|
||||||
if (code_seen('R')) duplicate_extruder_temp_offset = code_value_temp_diff();
|
if (code_seen('R')) duplicate_extruder_temp_offset = code_value_temp_diff();
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
||||||
@ -9127,7 +9123,7 @@ inline void gcode_M355() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline void gcode_M163() {
|
inline void gcode_M163() {
|
||||||
int mix_index = code_seen('S') ? code_value_int() : 0;
|
const int mix_index = code_seen('S') ? code_value_int() : 0;
|
||||||
if (mix_index < MIXING_STEPPERS) {
|
if (mix_index < MIXING_STEPPERS) {
|
||||||
float mix_value = code_seen('P') ? code_value_float() : 0.0;
|
float mix_value = code_seen('P') ? code_value_float() : 0.0;
|
||||||
NOLESS(mix_value, 0.0);
|
NOLESS(mix_value, 0.0);
|
||||||
@ -9144,7 +9140,7 @@ inline void gcode_M355() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline void gcode_M164() {
|
inline void gcode_M164() {
|
||||||
int tool_index = code_seen('S') ? code_value_int() : 0;
|
const int tool_index = code_seen('S') ? code_value_int() : 0;
|
||||||
if (tool_index < MIXING_VIRTUAL_TOOLS) {
|
if (tool_index < MIXING_VIRTUAL_TOOLS) {
|
||||||
normalize_mix();
|
normalize_mix();
|
||||||
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
||||||
@ -9542,7 +9538,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
|
|
||||||
tool_change(
|
tool_change(
|
||||||
tmp_extruder,
|
tmp_extruder,
|
||||||
code_seen('F') ? MMM_TO_MMS(code_value_axis_units(X_AXIS)) : 0.0,
|
code_seen('F') ? MMM_TO_MMS(code_value_linear_units()) : 0.0,
|
||||||
(tmp_extruder == active_extruder) || (code_seen('S') && code_value_bool())
|
(tmp_extruder == active_extruder) || (code_seen('S') && code_value_bool())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user