Browse Source

Low Point for delta calibration (#10363)

Luc Van Daele 7 years ago
parent
commit
ac2e0afb62
3 changed files with 10 additions and 27 deletions
  1. 1
    1
      Marlin/src/gcode/calibrate/G33.cpp
  2. 8
    25
      Marlin/src/module/probe.cpp
  3. 1
    1
      Marlin/src/module/probe.h

+ 1
- 1
Marlin/src/gcode/calibrate/G33.cpp View File

137
 
137
 
138
 inline float calibration_probe(const float nx, const float ny, const bool stow) {
138
 inline float calibration_probe(const float nx, const float ny, const bool stow) {
139
   #if HAS_BED_PROBE
139
   #if HAS_BED_PROBE
140
-    return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true);
140
+    return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
141
   #else
141
   #else
142
     UNUSED(stow);
142
     UNUSED(stow);
143
     return lcd_probe_pt(nx, ny);
143
     return lcd_probe_pt(nx, ny);

+ 8
- 25
Marlin/src/module/probe.cpp View File

539
  *
539
  *
540
  * @return The raw Z position where the probe was triggered
540
  * @return The raw Z position where the probe was triggered
541
  */
541
  */
542
-#define HAS_CALIBRATION_PROBE (ENABLED(DELTA_AUTO_CALIBRATION) && Z_PROBE_LOW_POINT < 0)
543
-static float run_z_probe(
544
-  #if HAS_CALIBRATION_PROBE
545
-    const bool is_calibration
546
-  #endif
547
-) {
542
+  static float run_z_probe() {
548
 
543
 
549
   #if ENABLED(DEBUG_LEVELING_FEATURE)
544
   #if ENABLED(DEBUG_LEVELING_FEATURE)
550
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
545
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
551
   #endif
546
   #endif
552
 
547
 
553
-  #if Z_PROBE_LOW_POINT < 0
554
-    // Stop the probe before it goes too low to prevent damage.
555
-    // If Z isn't known or this is a "calibration probe" then probe to -10mm.
556
-    #if !HAS_CALIBRATION_PROBE
557
-      constexpr bool is_calibration = false;
558
-    #endif
559
-    const float z_probe_low_point = !is_calibration && axis_known_position[Z_AXIS] ? -zprobe_zoffset + Z_PROBE_LOW_POINT : -10.0;
560
-  #else
561
-    // Assertively move down in all cases
562
-    constexpr float z_probe_low_point = -10.0;
563
-  #endif
548
+  // Stop the probe before it goes too low to prevent damage.
549
+  // If Z isn't known then probe to -10mm.
550
+  const float z_probe_low_point = axis_known_position[Z_AXIS] ? -zprobe_zoffset + Z_PROBE_LOW_POINT : -10.0;
564
 
551
 
565
   // Double-probing does a fast probe followed by a slow probe
552
   // Double-probing does a fast probe followed by a slow probe
566
   #if MULTIPLE_PROBING == 2
553
   #if MULTIPLE_PROBING == 2
645
  *   - Raise to the BETWEEN height
632
  *   - Raise to the BETWEEN height
646
  * - Return the probed Z position
633
  * - Return the probed Z position
647
  */
634
  */
648
-float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool is_calibration/*=false*/) {
635
+float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/) {
649
   #if ENABLED(DEBUG_LEVELING_FEATURE)
636
   #if ENABLED(DEBUG_LEVELING_FEATURE)
650
     if (DEBUGGING(LEVELING)) {
637
     if (DEBUGGING(LEVELING)) {
651
       SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx));
638
       SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx));
652
       SERIAL_ECHOPAIR(", ", LOGICAL_Y_POSITION(ry));
639
       SERIAL_ECHOPAIR(", ", LOGICAL_Y_POSITION(ry));
653
       SERIAL_ECHOPAIR(", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none");
640
       SERIAL_ECHOPAIR(", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none");
654
       SERIAL_ECHOPAIR(", ", int(verbose_level));
641
       SERIAL_ECHOPAIR(", ", int(verbose_level));
655
-      SERIAL_ECHOPAIR(", ", is_calibration ? "nozzle" : "probe");
642
+      SERIAL_ECHOPAIR(", ", probe_relative ? "probe" : "nozzle");
656
       SERIAL_ECHOLNPGM("_relative)");
643
       SERIAL_ECHOLNPGM("_relative)");
657
       DEBUG_POS("", current_position);
644
       DEBUG_POS("", current_position);
658
     }
645
     }
660
 
647
 
661
   // TODO: Adapt for SCARA, where the offset rotates
648
   // TODO: Adapt for SCARA, where the offset rotates
662
   float nx = rx, ny = ry;
649
   float nx = rx, ny = ry;
663
-  if (!is_calibration) {
650
+  if (probe_relative) {
664
     if (!position_is_reachable_by_probe(rx, ry)) return NAN;  // The given position is in terms of the probe
651
     if (!position_is_reachable_by_probe(rx, ry)) return NAN;  // The given position is in terms of the probe
665
     nx -= (X_PROBE_OFFSET_FROM_EXTRUDER);                     // Get the nozzle position
652
     nx -= (X_PROBE_OFFSET_FROM_EXTRUDER);                     // Get the nozzle position
666
     ny -= (Y_PROBE_OFFSET_FROM_EXTRUDER);
653
     ny -= (Y_PROBE_OFFSET_FROM_EXTRUDER);
684
 
671
 
685
   float measured_z = NAN;
672
   float measured_z = NAN;
686
   if (!DEPLOY_PROBE()) {
673
   if (!DEPLOY_PROBE()) {
687
-    measured_z = run_z_probe(
688
-      #if HAS_CALIBRATION_PROBE
689
-        is_calibration
690
-      #endif
691
-    ) + zprobe_zoffset;
674
+    measured_z = run_z_probe() + zprobe_zoffset;
692
 
675
 
693
     if (raise_after == PROBE_PT_RAISE)
676
     if (raise_after == PROBE_PT_RAISE)
694
       do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
677
       do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));

+ 1
- 1
Marlin/src/module/probe.h View File

40
     PROBE_PT_STOW,  // Do a complete stow after run_z_probe
40
     PROBE_PT_STOW,  // Do a complete stow after run_z_probe
41
     PROBE_PT_RAISE  // Raise to "between" clearance after run_z_probe
41
     PROBE_PT_RAISE  // Raise to "between" clearance after run_z_probe
42
   };
42
   };
43
-  float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool is_calibration=false);
43
+  float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
44
   #define DEPLOY_PROBE() set_probe_deployed(true)
44
   #define DEPLOY_PROBE() set_probe_deployed(true)
45
   #define STOW_PROBE() set_probe_deployed(false)
45
   #define STOW_PROBE() set_probe_deployed(false)
46
 #else
46
 #else

Loading…
Cancel
Save