|
@@ -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);
|