Browse Source

Add reporting to M290 (#15376)

InsanityAutomation 5 years ago
parent
commit
0ca6abce72
3 changed files with 61 additions and 29 deletions
  1. 6
    11
      Marlin/src/feature/babystep.cpp
  2. 12
    17
      Marlin/src/feature/babystep.h
  3. 43
    1
      Marlin/src/gcode/motion/M290.cpp

+ 6
- 11
Marlin/src/feature/babystep.cpp View File

@@ -36,13 +36,10 @@
36 36
 Babystep babystep;
37 37
 
38 38
 volatile int16_t Babystep::steps[BS_TODO_AXIS(Z_AXIS) + 1];
39
-
40
-#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
41
-  int16_t Babystep::accum;
42
-  #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
43
-    int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
44
-  #endif
39
+#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
40
+  int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
45 41
 #endif
42
+int16_t Babystep::accum;
46 43
 
47 44
 void Babystep::step_axis(const AxisEnum axis) {
48 45
   const int16_t curTodo = steps[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
@@ -75,11 +72,9 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
75 72
 
76 73
   if (!CAN_BABYSTEP(axis)) return;
77 74
 
78
-  #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
79
-    accum += distance; // Count up babysteps for the UI
80
-    #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
81
-      axis_total[BS_TOTAL_AXIS(axis)] += distance;
82
-    #endif
75
+  accum += distance; // Count up babysteps for the UI
76
+  #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
77
+    axis_total[BS_TOTAL_AXIS(axis)] += distance;
83 78
   #endif
84 79
 
85 80
   #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)

+ 12
- 17
Marlin/src/feature/babystep.h View File

@@ -29,7 +29,7 @@
29 29
   #define BS_TODO_AXIS(A) 0
30 30
 #endif
31 31
 
32
-#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(BABYSTEP_DISPLAY_TOTAL)
32
+#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
33 33
   #if ENABLED(BABYSTEP_XY)
34 34
     #define BS_TOTAL_AXIS(A) A
35 35
   #else
@@ -40,22 +40,17 @@
40 40
 class Babystep {
41 41
 public:
42 42
   static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1];
43
-
44
-  #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
45
-
46
-    static int16_t accum;                                     // Total babysteps in current edit
47
-
48
-    #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
49
-      static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];   // Total babysteps since G28
50
-      static inline void reset_total(const AxisEnum axis) {
51
-        if (true
52
-          #if ENABLED(BABYSTEP_XY)
53
-            && axis == Z_AXIS
54
-          #endif
55
-        ) axis_total[BS_TOTAL_AXIS(axis)] = 0;
56
-      }
57
-    #endif
58
-
43
+  static int16_t accum;                                     // Total babysteps in current edit
44
+
45
+  #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
46
+    static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];   // Total babysteps since G28
47
+    static inline void reset_total(const AxisEnum axis) {
48
+      if (true
49
+        #if ENABLED(BABYSTEP_XY)
50
+          && axis == Z_AXIS
51
+        #endif
52
+      ) axis_total[BS_TOTAL_AXIS(axis)] = 0;
53
+    }
59 54
   #endif
60 55
 
61 56
   static void add_steps(const AxisEnum axis, const int16_t distance);

+ 43
- 1
Marlin/src/gcode/motion/M290.cpp View File

@@ -34,6 +34,10 @@
34 34
   #include "../../core/serial.h"
35 35
 #endif
36 36
 
37
+#if ENABLED(MESH_BED_LEVELING)
38
+  #include "../../feature/bedlevel/bedlevel.h"
39
+#endif
40
+
37 41
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
38 42
 
39 43
   FORCE_INLINE void mod_zprobe_zoffset(const float &offs) {
@@ -60,13 +64,15 @@
60 64
 /**
61 65
  * M290: Babystepping
62 66
  *
67
+ * Send 'R' or no parameters for a report.
68
+ *
63 69
  *  X<linear> - Distance to step X
64 70
  *  Y<linear> - Distance to step Y
65 71
  *  Z<linear> - Distance to step Z
66 72
  *  S<linear> - Distance to step Z (alias for Z)
67 73
  *
68 74
  * With BABYSTEP_ZPROBE_OFFSET:
69
- *         P0 - Don't adjust the Z probe offset.
75
+ *  P0 - Don't adjust the Z probe offset
70 76
  */
71 77
 void GcodeSuite::M290() {
72 78
   #if ENABLED(BABYSTEP_XY)
@@ -87,6 +93,42 @@ void GcodeSuite::M290() {
87 93
       #endif
88 94
     }
89 95
   #endif
96
+
97
+  if (!parser.seen("XYZ") || parser.seen('R')) {
98
+    SERIAL_ECHO_START();
99
+
100
+    #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
101
+      SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET " " MSG_Z, probe_offset[Z_AXIS]);
102
+    #endif
103
+
104
+    #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
105
+    {
106
+      SERIAL_ECHOLNPAIR("Hotend ", int(active_extruder), "Offset"
107
+        #if ENABLED(BABYSTEP_XY)
108
+          " X", hotend_offset[X_AXIS][active_extruder],
109
+          " Y", hotend_offset[Y_AXIS][active_extruder],
110
+        #endif
111
+        " Z", hotend_offset[Z_AXIS][active_extruder]
112
+      );
113
+    }
114
+    #endif
115
+
116
+    #if ENABLED(MESH_BED_LEVELING)
117
+      SERIAL_ECHOLNPAIR("MBL Adjust Z", mbl.z_offset);
118
+    #endif
119
+
120
+    #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
121
+    {
122
+      SERIAL_ECHOLNPAIR("Babystep"
123
+        #if ENABLED(BABYSTEP_XY)
124
+          " X", babystep.axis_total[X_AXIS],
125
+          " Y", babystep.axis_total[Y_AXIS],
126
+        #endif
127
+        " Z", babystep.axis_total[Z_AXIS]
128
+      );
129
+    }
130
+    #endif
131
+  }
90 132
 }
91 133
 
92 134
 #endif // BABYSTEPPING

Loading…
Cancel
Save