|
@@ -0,0 +1,61 @@
|
|
1
|
+/**
|
|
2
|
+ * Marlin 3D Printer Firmware
|
|
3
|
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
4
|
+ *
|
|
5
|
+ * Based on Sprinter and grbl.
|
|
6
|
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
7
|
+ *
|
|
8
|
+ * This program is free software: you can redistribute it and/or modify
|
|
9
|
+ * it under the terms of the GNU General Public License as published by
|
|
10
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+ * (at your option) any later version.
|
|
12
|
+ *
|
|
13
|
+ * This program is distributed in the hope that it will be useful,
|
|
14
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+ * GNU General Public License for more details.
|
|
17
|
+ *
|
|
18
|
+ * You should have received a copy of the GNU General Public License
|
|
19
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+ *
|
|
21
|
+ */
|
|
22
|
+
|
|
23
|
+#include "../../inc/MarlinConfig.h"
|
|
24
|
+
|
|
25
|
+#if ENABLED(BABYSTEPPING)
|
|
26
|
+
|
|
27
|
+#include "../gcode.h"
|
|
28
|
+#include "../../module/probe.h"
|
|
29
|
+#include "../../module/temperature.h"
|
|
30
|
+#include "../../module/planner.h"
|
|
31
|
+
|
|
32
|
+/**
|
|
33
|
+ * M290: Babystepping
|
|
34
|
+ */
|
|
35
|
+void GcodeSuite::M290() {
|
|
36
|
+ #if ENABLED(BABYSTEP_XY)
|
|
37
|
+ for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
|
|
38
|
+ if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
|
|
39
|
+ float offs = constrain(parser.value_axis_units(a), -2, 2);
|
|
40
|
+ #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
41
|
+ if (a == Z_AXIS) {
|
|
42
|
+ zprobe_zoffset += offs;
|
|
43
|
+ refresh_zprobe_zoffset(true); // 'true' to not babystep
|
|
44
|
+ }
|
|
45
|
+ #endif
|
|
46
|
+ thermalManager.babystep_axis(a, offs * planner.axis_steps_per_mm[a]);
|
|
47
|
+ }
|
|
48
|
+ #else
|
|
49
|
+ if (parser.seenval('Z') || parser.seenval('S')) {
|
|
50
|
+ float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
|
|
51
|
+ #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
52
|
+ zprobe_zoffset += offs;
|
|
53
|
+ refresh_zprobe_zoffset(); // This will babystep the axis
|
|
54
|
+ #else
|
|
55
|
+ thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]);
|
|
56
|
+ #endif
|
|
57
|
+ }
|
|
58
|
+ #endif
|
|
59
|
+}
|
|
60
|
+
|
|
61
|
+#endif // BABYSTEPPING
|