Move [xyz]_endstop_adj to Endstops class
This commit is contained in:
parent
83c83e3127
commit
e8fc0e9a57
5 changed files with 82 additions and 68 deletions
|
|
@ -205,7 +205,7 @@
|
|||
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
|
||||
* M665 - Set delta configurations: "M665 L<diagonal rod> R<delta radius> S<segments/s> A<rod A trim mm> B<rod B trim mm> C<rod C trim mm> I<tower A trim angle> J<tower B trim angle> K<tower C trim angle>" (Requires DELTA)
|
||||
* M666 - Set/get offsets for delta (Requires DELTA) or dual endstops (Requires [XYZ]_DUAL_ENDSTOPS).
|
||||
* M666 - Set/get endstop offsets for delta (Requires DELTA) or dual endstops (Requires [XYZ]_DUAL_ENDSTOPS).
|
||||
* M701 - Load filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
* M702 - Unload filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
* M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)
|
||||
|
|
@ -565,16 +565,6 @@ uint8_t target_extruder;
|
|||
#define ADJUST_DELTA(V) NOOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
float x_endstop_adj; // Initialized by settings.load()
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
float y_endstop_adj; // Initialized by settings.load()
|
||||
#endif
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
float z_endstop_adj; // Initialized by settings.load()
|
||||
#endif
|
||||
|
||||
// Extruder offsets
|
||||
#if HOTENDS > 1
|
||||
float hotend_offset[XYZ][HOTENDS]; // Initialized by settings.load()
|
||||
|
|
@ -3030,8 +3020,8 @@ static void homeaxis(const AxisEnum axis) {
|
|||
const bool pos_dir = axis_home_dir > 0;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
if (axis == X_AXIS) {
|
||||
const bool lock_x1 = pos_dir ? (x_endstop_adj > 0) : (x_endstop_adj < 0);
|
||||
const float adj = FABS(x_endstop_adj);
|
||||
const bool lock_x1 = pos_dir ? (endstops.x_endstop_adj > 0) : (endstops.x_endstop_adj < 0);
|
||||
const float adj = FABS(endstops.x_endstop_adj);
|
||||
if (lock_x1) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
|
||||
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||
if (lock_x1) stepper.set_x_lock(false); else stepper.set_x2_lock(false);
|
||||
|
|
@ -3040,8 +3030,8 @@ static void homeaxis(const AxisEnum axis) {
|
|||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
if (axis == Y_AXIS) {
|
||||
const bool lock_y1 = pos_dir ? (y_endstop_adj > 0) : (y_endstop_adj < 0);
|
||||
const float adj = FABS(y_endstop_adj);
|
||||
const bool lock_y1 = pos_dir ? (endstops.y_endstop_adj > 0) : (endstops.y_endstop_adj < 0);
|
||||
const float adj = FABS(endstops.y_endstop_adj);
|
||||
if (lock_y1) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
|
||||
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||
if (lock_y1) stepper.set_y_lock(false); else stepper.set_y2_lock(false);
|
||||
|
|
@ -3050,8 +3040,8 @@ static void homeaxis(const AxisEnum axis) {
|
|||
#endif
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
if (axis == Z_AXIS) {
|
||||
const bool lock_z1 = pos_dir ? (z_endstop_adj > 0) : (z_endstop_adj < 0);
|
||||
const float adj = FABS(z_endstop_adj);
|
||||
const bool lock_z1 = pos_dir ? (endstops.z_endstop_adj > 0) : (endstops.z_endstop_adj < 0);
|
||||
const float adj = FABS(endstops.z_endstop_adj);
|
||||
if (lock_z1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
|
||||
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||
if (lock_z1) stepper.set_z_lock(false); else stepper.set_z2_lock(false);
|
||||
|
|
@ -9021,26 +9011,45 @@ inline void gcode_M205() {
|
|||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
||||
|
||||
/**
|
||||
* M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
|
||||
* M666: Set Dual Endstops offsets for X, Y, and/or Z.
|
||||
* With no parameters report current offsets.
|
||||
*/
|
||||
inline void gcode_M666() {
|
||||
SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
|
||||
bool report = true;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
if (parser.seen('X')) x_endstop_adj = parser.value_linear_units();
|
||||
SERIAL_ECHOPAIR(" X", x_endstop_adj);
|
||||
if (parser.seenval('X')) {
|
||||
endstops.x_endstop_adj = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
if (parser.seen('Y')) y_endstop_adj = parser.value_linear_units();
|
||||
SERIAL_ECHOPAIR(" Y", y_endstop_adj);
|
||||
if (parser.seenval('Y')) {
|
||||
endstops.y_endstop_adj = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
#endif
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
if (parser.seen('Z')) z_endstop_adj = parser.value_linear_units();
|
||||
SERIAL_ECHOPAIR(" Z", z_endstop_adj);
|
||||
if (parser.seenval('Z')) {
|
||||
endstops.z_endstop_adj = parser.value_linear_units();
|
||||
report = false;
|
||||
}
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
if (report) {
|
||||
SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
SERIAL_ECHOPAIR(" X", endstops.x_endstop_adj);
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
SERIAL_ECHOPAIR(" Y", endstops.y_endstop_adj);
|
||||
#endif
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
SERIAL_ECHOPAIR(" Z", endstops.z_endstop_adj);
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !DELTA && Z_DUAL_ENDSTOPS
|
||||
#endif // X_DUAL_ENDSTOPS || Y_DUAL_ENDSTOPS || Z_DUAL_ENDSTOPS
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue