Merge pull request #10038 from thinkyhead/bf1_dual_endstops_offsets

[1.1.x] Dual XYZ endstops parity with 2.0.x
This commit is contained in:
Scott Lahteine 2018-03-10 07:17:20 -06:00 committed by GitHub
commit 72df10c669
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 85 additions and 71 deletions

View file

@ -89,7 +89,7 @@
* M24 - Start/resume SD print. (Requires SDSUPPORT)
* M25 - Pause SD print. (Requires SDSUPPORT)
* M26 - Set SD position in bytes: "M26 S12345". (Requires SDSUPPORT)
* M27 - Report SD print status. (Requires SDSUPPORT) Or, with 'S<seconds>' sets the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
* M27 - Report SD print status. (Requires SDSUPPORT) Or, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
* M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT)
* M29 - Stop SD write. (Requires SDSUPPORT)
* M30 - Delete file from SD: "M30 /path/file.gco"
@ -134,7 +134,7 @@
* M119 - Report endstops status.
* M120 - Enable endstops detection.
* M121 - Disable endstops detection.
* M122 - Debug stepper (Requires HAVE_TMC2130)
* M122 - Debug stepper (Requires HAVE_TMC2130 or HAVE_TMC2208)
* M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
* M126 - Solenoid Air Valve Open. (Requires BARICUDA)
* M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
@ -203,9 +203,9 @@
* M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* 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 delta endstop adjustment. (Requires DELTA)
* M605 - Set dual x-carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
* 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);
@ -9027,26 +9017,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)