Browse Source

Simplified probe_pt (in M48)

Scott Lahteine 9 years ago
parent
commit
89a2aa026b
1 changed files with 10 additions and 47 deletions
  1. 10
    47
      Marlin/Marlin_main.cpp

+ 10
- 47
Marlin/Marlin_main.cpp View File

4204
            Y_current = current_position[Y_AXIS];
4204
            Y_current = current_position[Y_AXIS];
4205
 
4205
 
4206
     #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
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
     #else
4208
     #else
4209
-      bool deploy_probe_for_each_reading = code_seen('E');
4209
+      bool stow_probe_after_each = code_seen('E');
4210
     #endif
4210
     #endif
4211
 
4211
 
4212
     float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
4212
     float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
4259
 
4259
 
4260
     setup_for_endstop_or_probe_move();
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
     randomSeed(millis());
4265
     randomSeed(millis());
4282
 
4266
 
4296
         if (verbose_level > 3) {
4280
         if (verbose_level > 3) {
4297
           SERIAL_ECHOPAIR("Starting radius: ", radius);
4281
           SERIAL_ECHOPAIR("Starting radius: ", radius);
4298
           SERIAL_ECHOPAIR("   angle: ", angle);
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
         for (uint8_t l = 0; l < n_legs - 1; l++) {
4288
         for (uint8_t l = 0; l < n_legs - 1; l++) {
4340
                 SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
4321
                 SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
4341
                 SERIAL_ECHOPAIR(", ", Y_current);
4322
                 SERIAL_ECHOPAIR(", ", Y_current);
4342
                 SERIAL_EOL;
4323
                 SERIAL_EOL;
4343
-                delay(50);
4344
               }
4324
               }
4345
             }
4325
             }
4346
           #endif
4326
           #endif
4350
             SERIAL_ECHOPAIR("y: ", Y_current);
4330
             SERIAL_ECHOPAIR("y: ", Y_current);
4351
             SERIAL_ECHOPAIR("  z: ", current_position[Z_AXIS]);
4331
             SERIAL_ECHOPAIR("  z: ", current_position[Z_AXIS]);
4352
             SERIAL_EOL;
4332
             SERIAL_EOL;
4353
-            delay(55);
4354
           }
4333
           }
4355
           do_blocking_move_to_xy(X_current, Y_current);
4334
           do_blocking_move_to_xy(X_current, Y_current);
4356
         } // n_legs loop
4335
         } // n_legs loop
4357
       } // n_legs
4336
       } // n_legs
4358
 
4337
 
4359
-      // The last probe will differ
4360
-      bool last_probe = (n == n_samples - 1);
4361
-
4362
       // Probe a single point
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
        * Get the current mean for the data points we have so far
4342
        * Get the current mean for the data points we have so far
4391
           SERIAL_PROTOCOL((int)n_samples);
4362
           SERIAL_PROTOCOL((int)n_samples);
4392
           SERIAL_PROTOCOLPGM("   z: ");
4363
           SERIAL_PROTOCOLPGM("   z: ");
4393
           SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4364
           SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4394
-          delay(50);
4395
           if (verbose_level > 2) {
4365
           if (verbose_level > 2) {
4396
             SERIAL_PROTOCOLPGM(" mean: ");
4366
             SERIAL_PROTOCOLPGM(" mean: ");
4397
             SERIAL_PROTOCOL_F(mean, 6);
4367
             SERIAL_PROTOCOL_F(mean, 6);
4402
         SERIAL_EOL;
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
     } // End of probe loop
4375
     } // End of probe loop
4415
 
4376
 
4377
+    stow_z_probe();
4378
+
4416
     if (verbose_level > 0) {
4379
     if (verbose_level > 0) {
4417
       SERIAL_PROTOCOLPGM("Mean: ");
4380
       SERIAL_PROTOCOLPGM("Mean: ");
4418
       SERIAL_PROTOCOL_F(mean, 6);
4381
       SERIAL_PROTOCOL_F(mean, 6);

Loading…
Cancel
Save