Ver código fonte

Merge pull request #1672 from thinkyhead/fix_probeaction

Fix mangled probe_pt calls
Scott Lahteine 10 anos atrás
pai
commit
f65f61fa72

+ 0
- 6
Marlin/Configuration.h Ver arquivo

@@ -417,12 +417,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
417 417
 
418 418
   #ifdef AUTO_BED_LEVELING_GRID
419 419
 
420
-    // Use one of these defines to specify the origin
421
-    // for a topographical map to be printed for your bed.
422
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
423
-    #define TOPO_ORIGIN OriginFrontLeft
424
-
425
-    // The edges of the rectangle in which to probe
426 420
     #define LEFT_PROBE_BED_POSITION 15
427 421
     #define RIGHT_PROBE_BED_POSITION 170
428 422
     #define FRONT_PROBE_BED_POSITION 20

+ 44
- 68
Marlin/Marlin_main.cpp Ver arquivo

@@ -1370,12 +1370,11 @@ static void retract_z_probe() {
1370 1370
 
1371 1371
 }
1372 1372
 
1373
-enum ProbeAction
1374
-{
1375
-    ProbeStay             = 0,
1376
-    ProbeEngage           = (1 << 0),
1377
-    ProbeRetract          = (1 << 1),
1378
-    ProbeEngageAndRetract = (ProbeEngage | ProbeRetract),
1373
+enum ProbeAction {
1374
+  ProbeStay             = 0,
1375
+  ProbeEngage           = BIT(0),
1376
+  ProbeRetract          = BIT(1),
1377
+  ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
1379 1378
 };
1380 1379
 
1381 1380
 /// Probe bed height at position (x,y), returns the measured z value
@@ -2178,7 +2177,7 @@ inline void gcode_G28() {
2178 2177
     #ifdef AUTO_BED_LEVELING_GRID
2179 2178
 
2180 2179
     #ifndef DELTA
2181
-      bool topo_flag = verbose_level > 2 || code_seen('T') || code_seen('t');
2180
+      bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t');
2182 2181
     #endif
2183 2182
 
2184 2183
       if (verbose_level > 0)
@@ -2239,9 +2238,10 @@ inline void gcode_G28() {
2239 2238
 
2240 2239
     st_synchronize();
2241 2240
 
2242
-  #ifdef DELTA
2243
-    reset_bed_level();
2244
-  #else
2241
+    #ifdef DELTA
2242
+      reset_bed_level();
2243
+    #else
2244
+
2245 2245
     // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
2246 2246
     //vector_3 corrected_position = plan_get_position_mm();
2247 2247
     //corrected_position.debug("position before G29");
@@ -2282,42 +2282,36 @@ inline void gcode_G28() {
2282 2282
       delta_grid_spacing[1] = yGridSpacing;
2283 2283
 
2284 2284
       float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
2285
-      if (code_seen(axis_codes[Z_AXIS])) {
2286
-        z_offset += code_value();
2287
-      }
2285
+      if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value();
2288 2286
     #endif
2289 2287
 
2290 2288
       int probePointCounter = 0;
2291 2289
       bool zig = true;
2292 2290
 
2293
-      for (int yCount=0; yCount < auto_bed_leveling_grid_points; yCount++)
2294
-      {
2291
+      for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) {
2295 2292
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2296 2293
         int xStart, xStop, xInc;
2297 2294
 
2298
-        if (zig)
2299
-        {
2295
+        if (zig) {
2300 2296
           xStart = 0;
2301 2297
           xStop = auto_bed_leveling_grid_points;
2302 2298
           xInc = 1;
2303 2299
           zig = false;
2304 2300
         }
2305
-        else
2306
-        {
2301
+        else {
2307 2302
           xStart = auto_bed_leveling_grid_points - 1;
2308 2303
           xStop = -1;
2309 2304
           xInc = -1;
2310 2305
           zig = true;
2311 2306
         }
2312 2307
 
2313
-      #ifndef DELTA
2314
-        // If topo_flag is set then don't zig-zag. Just scan in one direction.
2315
-        // This gets the probe points in more readable order.
2316
-        if (!topo_flag) zig = !zig;
2317
-      #endif
2308
+        #ifndef DELTA
2309
+          // If do_topography_map is set then don't zig-zag. Just scan in one direction.
2310
+          // This gets the probe points in more readable order.
2311
+          if (!do_topography_map) zig = !zig;
2312
+        #endif
2318 2313
 
2319
-        for (int xCount=xStart; xCount != xStop; xCount += xInc)
2320
-        {
2314
+        for (int xCount = xStart; xCount != xStop; xCount += xInc) {
2321 2315
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2322 2316
 
2323 2317
           // raise extruder
@@ -2384,49 +2378,31 @@ inline void gcode_G28() {
2384 2378
         }
2385 2379
       }
2386 2380
 
2387
-      if (topo_flag) {
2388
-
2389
-        int xx, yy;
2381
+      // Show the Topography map if enabled
2382
+      if (do_topography_map) {
2390 2383
 
2391 2384
         SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
2392
-        #if TOPO_ORIGIN == OriginFrontLeft
2393
-          SERIAL_PROTOCOLPGM("+-----------+\n");
2394
-          SERIAL_PROTOCOLPGM("|...Back....|\n");
2395
-          SERIAL_PROTOCOLPGM("|Left..Right|\n");
2396
-          SERIAL_PROTOCOLPGM("|...Front...|\n");
2397
-          SERIAL_PROTOCOLPGM("+-----------+\n");
2398
-          for (yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--)
2399
-        #else
2400
-          for (yy = 0; yy < auto_bed_leveling_grid_points; yy++)
2401
-        #endif
2402
-          {
2403
-            #if TOPO_ORIGIN == OriginBackRight
2404
-              for (xx = 0; xx < auto_bed_leveling_grid_points; xx++)
2405
-            #else
2406
-              for (xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--)
2407
-            #endif
2408
-              {
2409
-                int ind =
2410
-                  #if TOPO_ORIGIN == OriginBackRight || TOPO_ORIGIN == OriginFrontLeft
2411
-                    yy * auto_bed_leveling_grid_points + xx
2412
-                  #elif TOPO_ORIGIN == OriginBackLeft
2413
-                    xx * auto_bed_leveling_grid_points + yy
2414
-                  #elif TOPO_ORIGIN == OriginFrontRight
2415
-                    abl2 - xx * auto_bed_leveling_grid_points - yy - 1
2416
-                  #endif
2417
-                ;
2418
-                float diff = eqnBVector[ind] - mean;
2419
-                if (diff >= 0.0)
2420
-                  SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2421
-                else
2422
-                  SERIAL_PROTOCOLPGM(" ");
2423
-                SERIAL_PROTOCOL_F(diff, 5);
2424
-              } // xx
2425
-              SERIAL_EOL;
2426
-          } // yy
2385
+        SERIAL_PROTOCOLPGM("+-----------+\n");
2386
+        SERIAL_PROTOCOLPGM("|...Back....|\n");
2387
+        SERIAL_PROTOCOLPGM("|Left..Right|\n");
2388
+        SERIAL_PROTOCOLPGM("|...Front...|\n");
2389
+        SERIAL_PROTOCOLPGM("+-----------+\n");
2390
+
2391
+        for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2392
+          for (int xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) {
2393
+            int ind = yy * auto_bed_leveling_grid_points + xx;
2394
+            float diff = eqnBVector[ind] - mean;
2395
+            if (diff >= 0.0)
2396
+              SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2397
+            else
2398
+              SERIAL_PROTOCOLPGM(" ");
2399
+            SERIAL_PROTOCOL_F(diff, 5);
2400
+          } // xx
2427 2401
           SERIAL_EOL;
2402
+        } // yy
2403
+        SERIAL_EOL;
2428 2404
 
2429
-      } //topo_flag
2405
+      } //do_topography_map
2430 2406
 
2431 2407
 
2432 2408
       set_bed_level_equation_lsq(plane_equation_coefficients);
@@ -2448,9 +2424,9 @@ inline void gcode_G28() {
2448 2424
         z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level);
2449 2425
       }
2450 2426
       else {
2451
-        z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level=verbose_level);
2452
-        z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
2453
-        z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
2427
+        z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngageAndRetract, verbose_level);
2428
+        z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level);
2429
+        z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level);
2454 2430
       }
2455 2431
       clean_up_after_endstop_move();
2456 2432
       set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);

+ 0
- 6
Marlin/configurator/config/Configuration.h Ver arquivo

@@ -440,12 +440,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
440 440
 
441 441
   #ifdef AUTO_BED_LEVELING_GRID
442 442
 
443
-    // Use one of these defines to specify the origin
444
-    // for a topographical map to be printed for your bed.
445
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
446
-    #define TOPO_ORIGIN OriginFrontLeft
447
-
448
-    // The edges of the rectangle in which to probe
449 443
     #define LEFT_PROBE_BED_POSITION 15
450 444
     #define RIGHT_PROBE_BED_POSITION 170
451 445
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/Felix/Configuration.h Ver arquivo

@@ -386,12 +386,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
386 386
   // Note: this feature occupies 10'206 byte
387 387
   #ifdef AUTO_BED_LEVELING_GRID
388 388
 
389
-    // Use one of these defines to specify the origin
390
-    // for a topographical map to be printed for your bed.
391
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
392
-    #define TOPO_ORIGIN OriginFrontLeft
393
-
394
-    // set the rectangle in which to probe
389
+home_offset    // set the rectangle in which to probe
395 390
     #define LEFT_PROBE_BED_POSITION 15
396 391
     #define RIGHT_PROBE_BED_POSITION 170
397 392
     #define BACK_PROBE_BED_POSITION 180

+ 1
- 6
Marlin/example_configurations/Felix/Configuration_DUAL.h Ver arquivo

@@ -386,12 +386,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
386 386
   // Note: this feature occupies 10'206 byte
387 387
   #ifdef AUTO_BED_LEVELING_GRID
388 388
 
389
-    // Use one of these defines to specify the origin
390
-    // for a topographical map to be printed for your bed.
391
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
392
-    #define TOPO_ORIGIN OriginFrontLeft
393
-
394
-    // set the rectangle in which to probe
389
+home_offset    // set the rectangle in which to probe
395 390
     #define LEFT_PROBE_BED_POSITION 15
396 391
     #define RIGHT_PROBE_BED_POSITION 170
397 392
     #define BACK_PROBE_BED_POSITION 180

+ 0
- 6
Marlin/example_configurations/Hephestos/Configuration.h Ver arquivo

@@ -410,12 +410,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
410 410
 
411 411
   #ifdef AUTO_BED_LEVELING_GRID
412 412
 
413
-    // Use one of these defines to specify the origin
414
-    // for a topographical map to be printed for your bed.
415
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
416
-    #define TOPO_ORIGIN OriginFrontLeft
417
-
418
-    // The edges of the rectangle in which to probe
419 413
     #define LEFT_PROBE_BED_POSITION 15
420 414
     #define RIGHT_PROBE_BED_POSITION 170
421 415
     #define FRONT_PROBE_BED_POSITION 20

+ 0
- 6
Marlin/example_configurations/K8200/Configuration.h Ver arquivo

@@ -415,12 +415,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
415 415
 
416 416
   #ifdef AUTO_BED_LEVELING_GRID
417 417
 
418
-    // Use one of these defines to specify the origin
419
-    // for a topographical map to be printed for your bed.
420
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
421
-    #define TOPO_ORIGIN OriginFrontLeft
422
-
423
-    // The edges of the rectangle in which to probe
424 418
     #define LEFT_PROBE_BED_POSITION 15
425 419
     #define RIGHT_PROBE_BED_POSITION 170
426 420
     #define FRONT_PROBE_BED_POSITION 20

+ 0
- 6
Marlin/example_configurations/SCARA/Configuration.h Ver arquivo

@@ -439,12 +439,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
439 439
 
440 440
   #ifdef AUTO_BED_LEVELING_GRID
441 441
 
442
-    // Use one of these defines to specify the origin
443
-    // for a topographical map to be printed for your bed.
444
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
445
-    #define TOPO_ORIGIN OriginFrontLeft
446
-
447
-    // The edges of the rectangle in which to probe
448 442
     #define LEFT_PROBE_BED_POSITION 15
449 443
     #define RIGHT_PROBE_BED_POSITION 170
450 444
     #define FRONT_PROBE_BED_POSITION 20

+ 0
- 6
Marlin/example_configurations/WITBOX/Configuration.h Ver arquivo

@@ -409,12 +409,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
409 409
 
410 410
   #ifdef AUTO_BED_LEVELING_GRID
411 411
 
412
-    // Use one of these defines to specify the origin
413
-    // for a topographical map to be printed for your bed.
414
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
415
-    #define TOPO_ORIGIN OriginFrontLeft
416
-
417
-    // The edges of the rectangle in which to probe
418 412
     #define LEFT_PROBE_BED_POSITION 15
419 413
     #define RIGHT_PROBE_BED_POSITION 170
420 414
     #define FRONT_PROBE_BED_POSITION 20

+ 0
- 6
Marlin/example_configurations/makibox/Configuration.h Ver arquivo

@@ -407,12 +407,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
407 407
 
408 408
   #ifdef AUTO_BED_LEVELING_GRID
409 409
 
410
-    // Use one of these defines to specify the origin
411
-    // for a topographical map to be printed for your bed.
412
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
413
-    #define TOPO_ORIGIN OriginFrontLeft
414
-
415
-    // The edges of the rectangle in which to probe
416 410
     #define LEFT_PROBE_BED_POSITION 15
417 411
     #define RIGHT_PROBE_BED_POSITION 170
418 412
     #define FRONT_PROBE_BED_POSITION 20

+ 0
- 6
Marlin/example_configurations/tvrrug/Round2/Configuration.h Ver arquivo

@@ -409,12 +409,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
409 409
 
410 410
   #ifdef AUTO_BED_LEVELING_GRID
411 411
 
412
-    // Use one of these defines to specify the origin
413
-    // for a topographical map to be printed for your bed.
414
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
415
-    #define TOPO_ORIGIN OriginFrontLeft
416
-
417
-    // The edges of the rectangle in which to probe
418 412
     #define LEFT_PROBE_BED_POSITION 15
419 413
     #define RIGHT_PROBE_BED_POSITION 170
420 414
     #define FRONT_PROBE_BED_POSITION 20

Carregando…
Cancelar
Salvar