Browse Source

Fix mangled probe_pt calls

- Address issue #1669
- Remove the TOPO_ORIGIN configuration setting
Scott Lahteine 10 years ago
parent
commit
146501215f

+ 1
- 6
Marlin/Configuration.h View File

417
 
417
 
418
   #ifdef AUTO_BED_LEVELING_GRID
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
420
+home_offset    // The edges of the rectangle in which to probe
426
     #define LEFT_PROBE_BED_POSITION 15
421
     #define LEFT_PROBE_BED_POSITION 15
427
     #define RIGHT_PROBE_BED_POSITION 170
422
     #define RIGHT_PROBE_BED_POSITION 170
428
     #define FRONT_PROBE_BED_POSITION 20
423
     #define FRONT_PROBE_BED_POSITION 20

+ 44
- 68
Marlin/Marlin_main.cpp View File

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
 /// Probe bed height at position (x,y), returns the measured z value
1380
 /// Probe bed height at position (x,y), returns the measured z value
2178
     #ifdef AUTO_BED_LEVELING_GRID
2177
     #ifdef AUTO_BED_LEVELING_GRID
2179
 
2178
 
2180
     #ifndef DELTA
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
     #endif
2181
     #endif
2183
 
2182
 
2184
       if (verbose_level > 0)
2183
       if (verbose_level > 0)
2239
 
2238
 
2240
     st_synchronize();
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
     // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
2245
     // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
2246
     //vector_3 corrected_position = plan_get_position_mm();
2246
     //vector_3 corrected_position = plan_get_position_mm();
2247
     //corrected_position.debug("position before G29");
2247
     //corrected_position.debug("position before G29");
2282
       delta_grid_spacing[1] = yGridSpacing;
2282
       delta_grid_spacing[1] = yGridSpacing;
2283
 
2283
 
2284
       float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
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
     #endif
2286
     #endif
2289
 
2287
 
2290
       int probePointCounter = 0;
2288
       int probePointCounter = 0;
2291
       bool zig = true;
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
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2292
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2296
         int xStart, xStop, xInc;
2293
         int xStart, xStop, xInc;
2297
 
2294
 
2298
-        if (zig)
2299
-        {
2295
+        if (zig) {
2300
           xStart = 0;
2296
           xStart = 0;
2301
           xStop = auto_bed_leveling_grid_points;
2297
           xStop = auto_bed_leveling_grid_points;
2302
           xInc = 1;
2298
           xInc = 1;
2303
           zig = false;
2299
           zig = false;
2304
         }
2300
         }
2305
-        else
2306
-        {
2301
+        else {
2307
           xStart = auto_bed_leveling_grid_points - 1;
2302
           xStart = auto_bed_leveling_grid_points - 1;
2308
           xStop = -1;
2303
           xStop = -1;
2309
           xInc = -1;
2304
           xInc = -1;
2310
           zig = true;
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
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2315
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2322
 
2316
 
2323
           // raise extruder
2317
           // raise extruder
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
         SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
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
           SERIAL_EOL;
2401
           SERIAL_EOL;
2402
+        } // yy
2403
+        SERIAL_EOL;
2428
 
2404
 
2429
-      } //topo_flag
2405
+      } //do_topography_map
2430
 
2406
 
2431
 
2407
 
2432
       set_bed_level_equation_lsq(plane_equation_coefficients);
2408
       set_bed_level_equation_lsq(plane_equation_coefficients);
2448
         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);
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
       else {
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
       clean_up_after_endstop_move();
2431
       clean_up_after_endstop_move();
2456
       set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
2432
       set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);

+ 1
- 6
Marlin/configurator/config/Configuration.h View File

440
 
440
 
441
   #ifdef AUTO_BED_LEVELING_GRID
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
443
+home_offset    // The edges of the rectangle in which to probe
449
     #define LEFT_PROBE_BED_POSITION 15
444
     #define LEFT_PROBE_BED_POSITION 15
450
     #define RIGHT_PROBE_BED_POSITION 170
445
     #define RIGHT_PROBE_BED_POSITION 170
451
     #define FRONT_PROBE_BED_POSITION 20
446
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/Felix/Configuration.h View File

386
   // Note: this feature occupies 10'206 byte
386
   // Note: this feature occupies 10'206 byte
387
   #ifdef AUTO_BED_LEVELING_GRID
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
     #define LEFT_PROBE_BED_POSITION 15
390
     #define LEFT_PROBE_BED_POSITION 15
396
     #define RIGHT_PROBE_BED_POSITION 170
391
     #define RIGHT_PROBE_BED_POSITION 170
397
     #define BACK_PROBE_BED_POSITION 180
392
     #define BACK_PROBE_BED_POSITION 180

+ 1
- 6
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

386
   // Note: this feature occupies 10'206 byte
386
   // Note: this feature occupies 10'206 byte
387
   #ifdef AUTO_BED_LEVELING_GRID
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
     #define LEFT_PROBE_BED_POSITION 15
390
     #define LEFT_PROBE_BED_POSITION 15
396
     #define RIGHT_PROBE_BED_POSITION 170
391
     #define RIGHT_PROBE_BED_POSITION 170
397
     #define BACK_PROBE_BED_POSITION 180
392
     #define BACK_PROBE_BED_POSITION 180

+ 1
- 6
Marlin/example_configurations/Hephestos/Configuration.h View File

410
 
410
 
411
   #ifdef AUTO_BED_LEVELING_GRID
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
413
+home_offset    // The edges of the rectangle in which to probe
419
     #define LEFT_PROBE_BED_POSITION 15
414
     #define LEFT_PROBE_BED_POSITION 15
420
     #define RIGHT_PROBE_BED_POSITION 170
415
     #define RIGHT_PROBE_BED_POSITION 170
421
     #define FRONT_PROBE_BED_POSITION 20
416
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/K8200/Configuration.h View File

415
 
415
 
416
   #ifdef AUTO_BED_LEVELING_GRID
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
418
+home_offset    // The edges of the rectangle in which to probe
424
     #define LEFT_PROBE_BED_POSITION 15
419
     #define LEFT_PROBE_BED_POSITION 15
425
     #define RIGHT_PROBE_BED_POSITION 170
420
     #define RIGHT_PROBE_BED_POSITION 170
426
     #define FRONT_PROBE_BED_POSITION 20
421
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/SCARA/Configuration.h View File

439
 
439
 
440
   #ifdef AUTO_BED_LEVELING_GRID
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
442
+home_offset    // The edges of the rectangle in which to probe
448
     #define LEFT_PROBE_BED_POSITION 15
443
     #define LEFT_PROBE_BED_POSITION 15
449
     #define RIGHT_PROBE_BED_POSITION 170
444
     #define RIGHT_PROBE_BED_POSITION 170
450
     #define FRONT_PROBE_BED_POSITION 20
445
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/WITBOX/Configuration.h View File

409
 
409
 
410
   #ifdef AUTO_BED_LEVELING_GRID
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
412
+home_offset    // The edges of the rectangle in which to probe
418
     #define LEFT_PROBE_BED_POSITION 15
413
     #define LEFT_PROBE_BED_POSITION 15
419
     #define RIGHT_PROBE_BED_POSITION 170
414
     #define RIGHT_PROBE_BED_POSITION 170
420
     #define FRONT_PROBE_BED_POSITION 20
415
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/makibox/Configuration.h View File

407
 
407
 
408
   #ifdef AUTO_BED_LEVELING_GRID
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
410
+home_offset    // The edges of the rectangle in which to probe
416
     #define LEFT_PROBE_BED_POSITION 15
411
     #define LEFT_PROBE_BED_POSITION 15
417
     #define RIGHT_PROBE_BED_POSITION 170
412
     #define RIGHT_PROBE_BED_POSITION 170
418
     #define FRONT_PROBE_BED_POSITION 20
413
     #define FRONT_PROBE_BED_POSITION 20

+ 1
- 6
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

409
 
409
 
410
   #ifdef AUTO_BED_LEVELING_GRID
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
412
+home_offset    // The edges of the rectangle in which to probe
418
     #define LEFT_PROBE_BED_POSITION 15
413
     #define LEFT_PROBE_BED_POSITION 15
419
     #define RIGHT_PROBE_BED_POSITION 170
414
     #define RIGHT_PROBE_BED_POSITION 170
420
     #define FRONT_PROBE_BED_POSITION 20
415
     #define FRONT_PROBE_BED_POSITION 20

Loading…
Cancel
Save