|
@@ -4204,9 +4204,9 @@ inline void gcode_M42() {
|
4204
|
4204
|
Y_current = current_position[Y_AXIS];
|
4205
|
4205
|
|
4206
|
4206
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
4207
|
|
- const bool deploy_probe_for_each_reading = false;
|
|
4207
|
+ const bool stow_probe_after_each = false;
|
4208
|
4208
|
#else
|
4209
|
|
- bool deploy_probe_for_each_reading = code_seen('E');
|
|
4209
|
+ bool stow_probe_after_each = code_seen('E');
|
4210
|
4210
|
#endif
|
4211
|
4211
|
|
4212
|
4212
|
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
@@ -4259,24 +4259,8 @@ inline void gcode_M42() {
|
4259
|
4259
|
|
4260
|
4260
|
setup_for_endstop_or_probe_move();
|
4261
|
4261
|
|
4262
|
|
- do_probe_raise(Z_RAISE_BEFORE_PROBING);
|
4263
|
|
-
|
4264
|
|
- feedrate = XY_PROBE_FEEDRATE;
|
4265
|
|
- do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
4266
|
|
-
|
4267
|
|
- /**
|
4268
|
|
- * OK, do the initial probe to get us close to the bed.
|
4269
|
|
- * Then retrace the right amount and use that in subsequent probes
|
4270
|
|
- */
|
4271
|
|
-
|
4272
|
|
- // Height before each probe (except the first)
|
4273
|
|
- float z_between = deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS;
|
4274
|
|
-
|
4275
|
|
- // Deploy the probe and probe the first point
|
4276
|
|
- probe_pt(X_probe_location, Y_probe_location,
|
4277
|
|
- Z_RAISE_BEFORE_PROBING,
|
4278
|
|
- deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
|
4279
|
|
- verbose_level);
|
|
4262
|
+ // Move to the first point, deploy, and probe
|
|
4263
|
+ probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
|
4280
|
4264
|
|
4281
|
4265
|
randomSeed(millis());
|
4282
|
4266
|
|
|
@@ -4296,12 +4280,9 @@ inline void gcode_M42() {
|
4296
|
4280
|
if (verbose_level > 3) {
|
4297
|
4281
|
SERIAL_ECHOPAIR("Starting radius: ", radius);
|
4298
|
4282
|
SERIAL_ECHOPAIR(" angle: ", angle);
|
4299
|
|
- delay(100);
|
4300
|
|
- if (dir > 0)
|
4301
|
|
- SERIAL_ECHO(" Direction: Counter Clockwise \n");
|
4302
|
|
- else
|
4303
|
|
- SERIAL_ECHO(" Direction: Clockwise \n");
|
4304
|
|
- delay(100);
|
|
4283
|
+ SERIAL_ECHO(" Direction: ");
|
|
4284
|
+ if (dir > 0) SERIAL_ECHO("Counter ");
|
|
4285
|
+ SERIAL_ECHOLN("Clockwise");
|
4305
|
4286
|
}
|
4306
|
4287
|
|
4307
|
4288
|
for (uint8_t l = 0; l < n_legs - 1; l++) {
|
|
@@ -4340,7 +4321,6 @@ inline void gcode_M42() {
|
4340
|
4321
|
SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
|
4341
|
4322
|
SERIAL_ECHOPAIR(", ", Y_current);
|
4342
|
4323
|
SERIAL_EOL;
|
4343
|
|
- delay(50);
|
4344
|
4324
|
}
|
4345
|
4325
|
}
|
4346
|
4326
|
#endif
|
|
@@ -4350,22 +4330,13 @@ inline void gcode_M42() {
|
4350
|
4330
|
SERIAL_ECHOPAIR("y: ", Y_current);
|
4351
|
4331
|
SERIAL_ECHOPAIR(" z: ", current_position[Z_AXIS]);
|
4352
|
4332
|
SERIAL_EOL;
|
4353
|
|
- delay(55);
|
4354
|
4333
|
}
|
4355
|
4334
|
do_blocking_move_to_xy(X_current, Y_current);
|
4356
|
4335
|
} // n_legs loop
|
4357
|
4336
|
} // n_legs
|
4358
|
4337
|
|
4359
|
|
- // The last probe will differ
|
4360
|
|
- bool last_probe = (n == n_samples - 1);
|
4361
|
|
-
|
4362
|
4338
|
// Probe a single point
|
4363
|
|
- sample_set[n] = probe_pt(
|
4364
|
|
- X_probe_location, Y_probe_location,
|
4365
|
|
- z_between,
|
4366
|
|
- deploy_probe_for_each_reading ? ProbeDeployAndStow : last_probe ? ProbeStow : ProbeStay,
|
4367
|
|
- verbose_level
|
4368
|
|
- );
|
|
4339
|
+ sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
|
4369
|
4340
|
|
4370
|
4341
|
/**
|
4371
|
4342
|
* Get the current mean for the data points we have so far
|
|
@@ -4391,7 +4362,6 @@ inline void gcode_M42() {
|
4391
|
4362
|
SERIAL_PROTOCOL((int)n_samples);
|
4392
|
4363
|
SERIAL_PROTOCOLPGM(" z: ");
|
4393
|
4364
|
SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
|
4394
|
|
- delay(50);
|
4395
|
4365
|
if (verbose_level > 2) {
|
4396
|
4366
|
SERIAL_PROTOCOLPGM(" mean: ");
|
4397
|
4367
|
SERIAL_PROTOCOL_F(mean, 6);
|
|
@@ -4402,17 +4372,10 @@ inline void gcode_M42() {
|
4402
|
4372
|
SERIAL_EOL;
|
4403
|
4373
|
}
|
4404
|
4374
|
|
4405
|
|
- // Raise before the next loop for the legs,
|
4406
|
|
- // or do the final raise after the last probe
|
4407
|
|
- if (last_probe)
|
4408
|
|
- do_probe_raise(Z_RAISE_AFTER_PROBING);
|
4409
|
|
- else if (n_legs) {
|
4410
|
|
- do_probe_raise(z_between);
|
4411
|
|
- if (!last_probe) delay(500);
|
4412
|
|
- }
|
4413
|
|
-
|
4414
|
4375
|
} // End of probe loop
|
4415
|
4376
|
|
|
4377
|
+ stow_z_probe();
|
|
4378
|
+
|
4416
|
4379
|
if (verbose_level > 0) {
|
4417
|
4380
|
SERIAL_PROTOCOLPGM("Mean: ");
|
4418
|
4381
|
SERIAL_PROTOCOL_F(mean, 6);
|