Browse Source

Allow USE_GCODE_SUBCODES for debugging

Scott Lahteine 4 years ago
parent
commit
0ba18848af

+ 1
- 1
Marlin/src/gcode/geometry/G92.cpp View File

@@ -35,7 +35,7 @@ void GcodeSuite::G92() {
35 35
 
36 36
   bool sync_E = false, sync_XYZ = false;
37 37
 
38
-  #if USE_GCODE_SUBCODES
38
+  #if ENABLED(USE_GCODE_SUBCODES)
39 39
     const uint8_t subcode_G92 = parser.subcode;
40 40
   #else
41 41
     constexpr uint8_t subcode_G92 = 0;

+ 11
- 11
Marlin/src/gcode/parser.cpp View File

@@ -51,13 +51,13 @@ char *GCodeParser::command_ptr,
51 51
 char GCodeParser::command_letter;
52 52
 int GCodeParser::codenum;
53 53
 
54
-#if USE_GCODE_SUBCODES
54
+#if ENABLED(USE_GCODE_SUBCODES)
55 55
   uint8_t GCodeParser::subcode;
56 56
 #endif
57 57
 
58 58
 #if ENABLED(GCODE_MOTION_MODES)
59 59
   int16_t GCodeParser::motion_mode_codenum = -1;
60
-  #if USE_GCODE_SUBCODES
60
+  #if ENABLED(USE_GCODE_SUBCODES)
61 61
     uint8_t GCodeParser::motion_mode_subcode;
62 62
   #endif
63 63
 #endif
@@ -83,7 +83,7 @@ void GCodeParser::reset() {
83 83
   string_arg = nullptr;                 // No whole line argument
84 84
   command_letter = '?';                 // No command letter
85 85
   codenum = 0;                          // No command code
86
-  #if USE_GCODE_SUBCODES
86
+  #if ENABLED(USE_GCODE_SUBCODES)
87 87
     subcode = 0;                        // No command sub-code
88 88
   #endif
89 89
   #if ENABLED(FASTER_GCODE_PARSER)
@@ -187,12 +187,12 @@ void GCodeParser::parse(char *p) {
187 187
       do { codenum *= 10, codenum += *p++ - '0'; } while (NUMERIC(*p));
188 188
 
189 189
       // Allow for decimal point in command
190
-      #if USE_GCODE_SUBCODES
191
-      if (*p == '.') {
192
-        p++;
193
-        while (NUMERIC(*p))
194
-        subcode *= 10, subcode += *p++ - '0';
195
-      }
190
+      #if ENABLED(USE_GCODE_SUBCODES)
191
+        if (*p == '.') {
192
+          p++;
193
+          while (NUMERIC(*p))
194
+          subcode *= 10, subcode += *p++ - '0';
195
+        }
196 196
       #endif
197 197
 
198 198
       // Skip all spaces to get to the first argument, or nul
@@ -206,7 +206,7 @@ void GCodeParser::parse(char *p) {
206 206
                              )
207 207
         ) {
208 208
           motion_mode_codenum = codenum;
209
-          #if USE_GCODE_SUBCODES
209
+          #if ENABLED(USE_GCODE_SUBCODES)
210 210
             motion_mode_subcode = subcode;
211 211
           #endif
212 212
         }
@@ -225,7 +225,7 @@ void GCodeParser::parse(char *p) {
225 225
         if (motion_mode_codenum < 0) return;
226 226
         command_letter = 'G';
227 227
         codenum = motion_mode_codenum;
228
-        #if USE_GCODE_SUBCODES
228
+        #if ENABLED(USE_GCODE_SUBCODES)
229 229
           subcode = motion_mode_subcode;
230 230
         #endif
231 231
         p--; // Back up one character to use the current parameter

+ 2
- 2
Marlin/src/gcode/parser.h View File

@@ -85,13 +85,13 @@ public:
85 85
               *string_arg,                // string of command line
86 86
               command_letter;             // G, M, or T
87 87
   static int codenum;                     // 123
88
-  #if USE_GCODE_SUBCODES
88
+  #if ENABLED(USE_GCODE_SUBCODES)
89 89
     static uint8_t subcode;               // .1
90 90
   #endif
91 91
 
92 92
   #if ENABLED(GCODE_MOTION_MODES)
93 93
     static int16_t motion_mode_codenum;
94
-    #if USE_GCODE_SUBCODES
94
+    #if ENABLED(USE_GCODE_SUBCODES)
95 95
       static uint8_t motion_mode_subcode;
96 96
     #endif
97 97
     FORCE_INLINE static void cancel_motion_mode() { motion_mode_codenum = -1; }

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

@@ -2110,7 +2110,9 @@
2110 2110
 #endif
2111 2111
 
2112 2112
 // Add commands that need sub-codes to this list
2113
-#define USE_GCODE_SUBCODES ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY)
2113
+#if ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY)
2114
+  #define USE_GCODE_SUBCODES
2115
+#endif
2114 2116
 
2115 2117
 // Parking Extruder
2116 2118
 #if ENABLED(PARKING_EXTRUDER)

Loading…
Cancel
Save