2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 08:00:57 -06:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-27 23:57:50 -05:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
* 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
|
2020-07-22 22:20:14 -05:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-17 02:21:21 -05:00
|
|
|
#include "../../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
#if IS_KINEMATIC
|
|
|
|
|
|
|
|
#include "../gcode.h"
|
|
|
|
#include "../../module/motion.h"
|
|
|
|
|
2017-09-06 06:28:31 -05:00
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
2017-09-17 02:21:21 -05:00
|
|
|
#include "../../module/delta.h"
|
2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* M665: Set delta configurations
|
|
|
|
*
|
|
|
|
* H = delta height
|
|
|
|
* L = diagonal rod
|
|
|
|
* R = delta radius
|
|
|
|
* S = segments per second
|
|
|
|
* X = Alpha (Tower 1) angle trim
|
2020-06-27 23:53:44 -05:00
|
|
|
* Y = Beta (Tower 2) angle trim
|
2018-04-11 21:14:48 -05:00
|
|
|
* Z = Gamma (Tower 3) angle trim
|
2021-03-03 17:46:32 -06:00
|
|
|
* A = Alpha (Tower 1) diagonal rod trim
|
|
|
|
* B = Beta (Tower 2) diagonal rod trim
|
|
|
|
* C = Gamma (Tower 3) diagonal rod trim
|
2017-09-06 06:28:31 -05:00
|
|
|
*/
|
2017-09-17 02:21:21 -05:00
|
|
|
void GcodeSuite::M665() {
|
2021-03-03 17:46:32 -06:00
|
|
|
if (parser.seenval('H')) delta_height = parser.value_linear_units();
|
|
|
|
if (parser.seenval('L')) delta_diagonal_rod = parser.value_linear_units();
|
|
|
|
if (parser.seenval('R')) delta_radius = parser.value_linear_units();
|
|
|
|
if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
|
|
|
|
if (parser.seenval('X')) delta_tower_angle_trim.a = parser.value_float();
|
|
|
|
if (parser.seenval('Y')) delta_tower_angle_trim.b = parser.value_float();
|
|
|
|
if (parser.seenval('Z')) delta_tower_angle_trim.c = parser.value_float();
|
|
|
|
if (parser.seenval('A')) delta_diagonal_rod_trim.a = parser.value_float();
|
|
|
|
if (parser.seenval('B')) delta_diagonal_rod_trim.b = parser.value_float();
|
|
|
|
if (parser.seenval('C')) delta_diagonal_rod_trim.c = parser.value_float();
|
2017-11-08 03:07:17 -06:00
|
|
|
recalc_delta_settings();
|
2017-09-06 06:28:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#elif IS_SCARA
|
|
|
|
|
2017-09-17 02:21:21 -05:00
|
|
|
#include "../../module/scara.h"
|
|
|
|
|
2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* M665: Set SCARA settings
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
*
|
|
|
|
* S[segments-per-second] - Segments-per-second
|
|
|
|
* P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle
|
|
|
|
* T[theta-offset] - Theta offset, added to the elbow (B/Y) angle
|
2018-11-03 03:56:33 -05:00
|
|
|
* Z[z-offset] - Z offset, added to Z
|
2017-09-06 06:28:31 -05:00
|
|
|
*
|
|
|
|
* A, P, and X are all aliases for the shoulder angle
|
|
|
|
* B, T, and Y are all aliases for the elbow angle
|
|
|
|
*/
|
2017-09-17 02:21:21 -05:00
|
|
|
void GcodeSuite::M665() {
|
2018-11-03 03:56:33 -05:00
|
|
|
if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2018-11-03 03:56:33 -05:00
|
|
|
#if HAS_SCARA_OFFSET
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2019-09-29 04:25:39 -05:00
|
|
|
if (parser.seenval('Z')) scara_home_offset.z = parser.value_linear_units();
|
2018-11-03 03:56:33 -05:00
|
|
|
|
|
|
|
const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X');
|
|
|
|
const uint8_t sumAPX = hasA + hasP + hasX;
|
|
|
|
if (sumAPX) {
|
|
|
|
if (sumAPX == 1)
|
2019-09-29 04:25:39 -05:00
|
|
|
scara_home_offset.a = parser.value_float();
|
2018-11-03 03:56:33 -05:00
|
|
|
else {
|
2018-11-29 16:58:58 -06:00
|
|
|
SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
|
2018-11-03 03:56:33 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool hasB = parser.seenval('B'), hasT = parser.seenval('T'), hasY = parser.seenval('Y');
|
|
|
|
const uint8_t sumBTY = hasB + hasT + hasY;
|
|
|
|
if (sumBTY) {
|
|
|
|
if (sumBTY == 1)
|
2019-09-29 04:25:39 -05:00
|
|
|
scara_home_offset.b = parser.value_float();
|
2018-11-03 03:56:33 -05:00
|
|
|
else {
|
2018-11-29 16:58:58 -06:00
|
|
|
SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
|
2018-11-03 03:56:33 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAS_SCARA_OFFSET
|
2017-09-06 06:28:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2017-09-17 02:21:21 -05:00
|
|
|
|
|
|
|
#endif // IS_KINEMATIC
|