2017-09-06 13:28:31 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-17 09:25:52 +02:00
|
|
|
#include "../../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
#include "../gcode.h"
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
2017-09-17 09:25:52 +02:00
|
|
|
#include "../../module/delta.h"
|
|
|
|
#include "../../module/motion.h"
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
/**
|
|
|
|
* M666: Set delta endstop adjustment
|
|
|
|
*/
|
2017-09-17 09:25:52 +02:00
|
|
|
void GcodeSuite::M666() {
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
2017-09-17 09:25:52 +02:00
|
|
|
SERIAL_ECHOLNPGM(">>> M666");
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
LOOP_XYZ(i) {
|
|
|
|
if (parser.seen(axis_codes[i])) {
|
2017-09-24 09:18:15 +02:00
|
|
|
const float v = parser.value_linear_units();
|
|
|
|
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
2017-09-08 22:35:25 +02:00
|
|
|
SERIAL_ECHOPAIR("delta_endstop_adj[", axis_codes[i]);
|
|
|
|
SERIAL_ECHOLNPAIR("] = ", delta_endstop_adj[i]);
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
2017-09-17 09:25:52 +02:00
|
|
|
SERIAL_ECHOLNPGM("<<< M666");
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-03-10 12:55:25 +01:00
|
|
|
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2017-09-18 12:56:10 +02:00
|
|
|
#include "../../module/endstops.h"
|
2017-09-17 09:25:52 +02:00
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
/**
|
2018-03-10 12:55:25 +01:00
|
|
|
* M666: Set Dual Endstops offsets for X, Y, and/or Z.
|
|
|
|
* With no parameters report current offsets.
|
2017-09-06 13:28:31 +02:00
|
|
|
*/
|
2018-03-10 12:55:25 +01:00
|
|
|
inline void gcode_M666() {
|
|
|
|
bool report = true;
|
2017-10-29 09:43:44 +01:00
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
2018-03-10 12:55:25 +01:00
|
|
|
if (parser.seen('X')) {
|
|
|
|
endstops.x_endstop_adj = parser.value_linear_units();
|
|
|
|
report = false;
|
|
|
|
}
|
2017-10-29 09:43:44 +01:00
|
|
|
#endif
|
|
|
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
2018-03-10 12:55:25 +01:00
|
|
|
if (parser.seen('Y')) {
|
|
|
|
endstops.y_endstop_adj = parser.value_linear_units();
|
|
|
|
report = false;
|
|
|
|
}
|
2017-10-29 09:43:44 +01:00
|
|
|
#endif
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
2018-03-10 12:55:25 +01:00
|
|
|
if (parser.seen('Z')) {
|
|
|
|
endstops.z_endstop_adj = parser.value_linear_units();
|
|
|
|
report = false;
|
|
|
|
}
|
2017-10-29 09:43:44 +01:00
|
|
|
#endif
|
2018-03-10 12:55:25 +01:00
|
|
|
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();
|
|
|
|
}
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
|
2018-03-10 12:55:25 +01:00
|
|
|
#endif // X_DUAL_ENDSTOPS || Y_DUAL_ENDSTOPS || Z_DUAL_ENDSTOPS
|
2017-09-17 09:25:52 +02:00
|
|
|
|
|
|
|
#endif // DELTA || Z_DUAL_ENDSTOPS
|