Browse Source

Add M290 Babystepping

Scott Lahteine 7 years ago
parent
commit
bd78ca0ee3

+ 4
- 0
Marlin/src/gcode/gcode.cpp View File

@@ -525,6 +525,10 @@ void GcodeSuite::process_next_command() {
525 525
         case 280: M280(); break;  // M280: Set servo position absolute
526 526
       #endif
527 527
 
528
+      #if ENABLED(BABYSTEPPING)
529
+        case 290: M290(); break;  // M290: Babystepping
530
+      #endif
531
+
528 532
       #if HAS_BUZZER
529 533
         case 300: M300(); break;  // M300: Play beep tone
530 534
       #endif

+ 5
- 0
Marlin/src/gcode/gcode.h View File

@@ -169,6 +169,7 @@
169 169
  * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
170 170
  * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
171 171
  * M280 - Set servo position absolute: "M280 P<index> S<angle|µs>". (Requires servos)
172
+ * M290 - Babystepping (Requires BABYSTEPPING)
172 173
  * M300 - Play beep sound S<frequency Hz> P<duration ms>
173 174
  * M301 - Set PID parameters P I and D. (Requires PIDTEMP)
174 175
  * M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. (Requires PREVENT_COLD_EXTRUSION)
@@ -585,6 +586,10 @@ private:
585 586
     static void M280();
586 587
   #endif
587 588
 
589
+  #if ENABLED(BABYSTEPPING)
590
+    static void M290();
591
+  #endif
592
+
588 593
   #if HAS_BUZZER
589 594
     static void M300();
590 595
   #endif

+ 61
- 0
Marlin/src/gcode/motion/M290.cpp View File

@@ -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

+ 1
- 3
Marlin/src/inc/SanityCheck.h View File

@@ -353,9 +353,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
353 353
  * Babystepping
354 354
  */
355 355
 #if ENABLED(BABYSTEPPING)
356
-  #if DISABLED(ULTRA_LCD) && DISABLED(I2C_POSITION_ENCODERS)
357
-    #error "BABYSTEPPING requires an LCD controller."
358
-  #elif ENABLED(SCARA)
356
+  #if ENABLED(SCARA)
359 357
     #error "BABYSTEPPING is not implemented for SCARA yet."
360 358
   #elif ENABLED(DELTA) && ENABLED(BABYSTEP_XY)
361 359
     #error "BABYSTEPPING only implemented for Z axis on deltabots."

Loading…
Cancel
Save