Browse Source

Allow USE_GCODE_SUBCODES for debugging

Scott Lahteine 5 years ago
parent
commit
0ba18848af

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

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

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

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

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

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

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

2110
 #endif
2110
 #endif
2111
 
2111
 
2112
 // Add commands that need sub-codes to this list
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
 // Parking Extruder
2117
 // Parking Extruder
2116
 #if ENABLED(PARKING_EXTRUDER)
2118
 #if ENABLED(PARKING_EXTRUDER)

Loading…
Cancel
Save