Browse Source

Clear up G29 compiler warnings

Scott Lahteine 7 years ago
parent
commit
5eb2b1a790
1 changed files with 24 additions and 9 deletions
  1. 24
    9
      Marlin/Marlin_main.cpp

+ 24
- 9
Marlin/Marlin_main.cpp View File

@@ -4167,17 +4167,25 @@ inline void gcode_G28() {
4167 4167
       #define ABL_VAR
4168 4168
     #endif
4169 4169
 
4170
-    ABL_VAR int verbose_level, abl_probe_index;
4170
+    ABL_VAR int verbose_level;
4171 4171
     ABL_VAR float xProbe, yProbe, measured_z;
4172 4172
     ABL_VAR bool dryrun, abl_should_enable;
4173 4173
 
4174
+    #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
4175
+      ABL_VAR int abl_probe_index;
4176
+    #endif
4177
+
4174 4178
     #if HAS_SOFTWARE_ENDSTOPS
4175 4179
       ABL_VAR bool enable_soft_endstops = true;
4176 4180
     #endif
4177 4181
 
4178 4182
     #if ABL_GRID
4179
-      ABL_VAR uint8_t PR_OUTER_VAR;
4180
-      ABL_VAR  int8_t PR_INNER_VAR;
4183
+
4184
+      #if ENABLED(PROBE_MANUALLY)
4185
+        ABL_VAR uint8_t PR_OUTER_VAR;
4186
+        ABL_VAR  int8_t PR_INNER_VAR;
4187
+      #endif
4188
+
4181 4189
       ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position;
4182 4190
       ABL_VAR float xGridSpacing, yGridSpacing;
4183 4191
 
@@ -4186,13 +4194,18 @@ inline void gcode_G28() {
4186 4194
       #if ABL_PLANAR
4187 4195
         ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X,
4188 4196
                         abl_grid_points_y = GRID_MAX_POINTS_Y;
4189
-        ABL_VAR int abl2;
4190 4197
         ABL_VAR bool do_topography_map;
4191 4198
       #else // 3-point
4192 4199
         uint8_t constexpr abl_grid_points_x = GRID_MAX_POINTS_X,
4193 4200
                           abl_grid_points_y = GRID_MAX_POINTS_Y;
4201
+      #endif
4194 4202
 
4195
-        int constexpr abl2 = ABL_GRID_MAX;
4203
+      #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(PROBE_MANUALLY)
4204
+        #if ABL_PLANAR
4205
+          ABL_VAR int abl2;
4206
+        #else // 3-point
4207
+          int constexpr abl2 = ABL_GRID_MAX;
4208
+        #endif
4196 4209
       #endif
4197 4210
 
4198 4211
       #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -4224,7 +4237,10 @@ inline void gcode_G28() {
4224 4237
      */
4225 4238
     if (!g29_in_progress) {
4226 4239
 
4227
-      abl_probe_index = 0;
4240
+      #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
4241
+        abl_probe_index = 0;
4242
+      #endif
4243
+
4228 4244
       abl_should_enable = planner.abl_enabled;
4229 4245
 
4230 4246
       #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -4284,7 +4300,7 @@ inline void gcode_G28() {
4284 4300
         return;
4285 4301
       }
4286 4302
 
4287
-      dryrun = code_seen('D') ? code_value_bool() : false;
4303
+      dryrun = code_seen('D') && code_value_bool();
4288 4304
 
4289 4305
       #if ENABLED(AUTO_BED_LEVELING_LINEAR)
4290 4306
 
@@ -4455,7 +4471,7 @@ inline void gcode_G28() {
4455 4471
       g29_in_progress = true;
4456 4472
 
4457 4473
       if (abl_probe_index == 0) {
4458
-        // For the initial G29 S2 save software endstop state
4474
+        // For the initial G29 save software endstop state
4459 4475
         #if HAS_SOFTWARE_ENDSTOPS
4460 4476
           enable_soft_endstops = soft_endstops_enabled;
4461 4477
         #endif
@@ -4586,7 +4602,6 @@ inline void gcode_G28() {
4586 4602
 
4587 4603
     #else // !PROBE_MANUALLY
4588 4604
 
4589
-
4590 4605
       bool stow_probe_after_each = code_seen('E');
4591 4606
 
4592 4607
       #if ABL_GRID

Loading…
Cancel
Save