Quellcode durchsuchen

G38 optional double touch

Made the double touch portion a conditional compile based on the
PROBE_DOUBLE_TOUCH flag.

==============================================

Bugfix

The current G38 only stopped a move if it involved the Z axis.

Moved all the G38 code to it's own section and put it where it would
always be executed no matter what axis was moving or if the endstop was
enabled.

Also added a comment to configuration_adv to alert the user the double
tap had to be turned on.

==============================================

Change G38 back to using Z_MIN_PROBE

There's no Z_MIN endstop if Z_DUAL_ENDSTOPS is enabled and you have them
set to the top of the gantry.

G38 started out as using the Z_MIN_PROBE pin.  I don't remember why we
changed it to the Z_MIN endstop.
Bob-the-Kuhn vor 8 Jahren
Ursprung
Commit
0934563b97

+ 1
- 0
Marlin/Configuration_adv.h Datei anzeigen

649
 //#define BEZIER_CURVE_SUPPORT
649
 //#define BEZIER_CURVE_SUPPORT
650
 
650
 
651
 // G38.2 and G38.3 Probe Target
651
 // G38.2 and G38.3 Probe Target
652
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
652
 //#define G38_PROBE_TARGET
653
 //#define G38_PROBE_TARGET
653
 #if ENABLED(G38_PROBE_TARGET)
654
 #if ENABLED(G38_PROBE_TARGET)
654
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
655
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 20
- 19
Marlin/Marlin_main.cpp Datei anzeigen

61
  * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
61
  * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
62
  * G31 - Dock sled (Z_PROBE_SLED only)
62
  * G31 - Dock sled (Z_PROBE_SLED only)
63
  * G32 - Undock sled (Z_PROBE_SLED only)
63
  * G32 - Undock sled (Z_PROBE_SLED only)
64
- * G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes
64
+ * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes
65
  * G90 - Use Absolute Coordinates
65
  * G90 - Use Absolute Coordinates
66
  * G91 - Use Relative Coordinates
66
  * G91 - Use Relative Coordinates
67
  * G92 - Set current position to coordinates given
67
  * G92 - Set current position to coordinates given
4488
     set_current_from_steppers_for_axis(ALL_AXES);
4488
     set_current_from_steppers_for_axis(ALL_AXES);
4489
     SYNC_PLAN_POSITION_KINEMATIC();
4489
     SYNC_PLAN_POSITION_KINEMATIC();
4490
 
4490
 
4491
-    // Only do remaining moves if target was hit
4492
     if (G38_endstop_hit) {
4491
     if (G38_endstop_hit) {
4493
 
4492
 
4494
       G38_pass_fail = true;
4493
       G38_pass_fail = true;
4495
 
4494
 
4496
-      // Move away by the retract distance
4497
-      set_destination_to_current();
4498
-      LOOP_XYZ(i) destination[i] += retract_mm[i];
4499
-      endstops.enable(false);
4500
-      prepare_move_to_destination();
4501
-      stepper.synchronize();
4495
+      #if ENABLED(PROBE_DOUBLE_TOUCH)
4496
+        // Move away by the retract distance
4497
+        set_destination_to_current();
4498
+        LOOP_XYZ(i) destination[i] += retract_mm[i];
4499
+        endstops.enable(false);
4500
+        prepare_move_to_destination();
4501
+        stepper.synchronize();
4502
 
4502
 
4503
-      feedrate_mm_s /= 4;
4503
+        feedrate_mm_s /= 4;
4504
 
4504
 
4505
-      // Bump the target more slowly
4506
-      LOOP_XYZ(i) destination[i] -= retract_mm[i] * 2;
4505
+        // Bump the target more slowly
4506
+        LOOP_XYZ(i) destination[i] -= retract_mm[i] * 2;
4507
 
4507
 
4508
-      endstops.enable(true);
4509
-      G38_move = true;
4510
-      prepare_move_to_destination();
4511
-      stepper.synchronize();
4512
-      G38_move = false;
4508
+        endstops.enable(true);
4509
+        G38_move = true;
4510
+        prepare_move_to_destination();
4511
+        stepper.synchronize();
4512
+        G38_move = false;
4513
 
4513
 
4514
-      set_current_from_steppers_for_axis(ALL_AXES);
4515
-      SYNC_PLAN_POSITION_KINEMATIC();
4514
+        set_current_from_steppers_for_axis(ALL_AXES);
4515
+        SYNC_PLAN_POSITION_KINEMATIC();
4516
+      #endif
4516
     }
4517
     }
4517
 
4518
 
4518
     endstops.hit_on_purpose();
4519
     endstops.hit_on_purpose();
4524
    * G38.2 - probe toward workpiece, stop on contact, signal error if failure
4525
    * G38.2 - probe toward workpiece, stop on contact, signal error if failure
4525
    * G38.3 - probe toward workpiece, stop on contact
4526
    * G38.3 - probe toward workpiece, stop on contact
4526
    *
4527
    *
4527
-   * Like G28 except uses Z min endstop for all axes
4528
+   * Like G28 except uses Z min probe for all axes
4528
    */
4529
    */
4529
   inline void gcode_G38(bool is_38_2) {
4530
   inline void gcode_G38(bool is_38_2) {
4530
     // Get X Y Z E F
4531
     // Get X Y Z E F

+ 12
- 13
Marlin/endstops.cpp Datei anzeigen

259
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
259
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
260
   #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT))
260
   #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT))
261
 
261
 
262
-  #define _UPDATE_ENDSTOP(AXIS,MINMAX,CODE) do { \
262
+  #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
263
       UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
263
       UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
264
       if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && stepper.current_block->steps[_AXIS(AXIS)] > 0) { \
264
       if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && stepper.current_block->steps[_AXIS(AXIS)] > 0) { \
265
         _ENDSTOP_HIT(AXIS); \
265
         _ENDSTOP_HIT(AXIS); \
266
         stepper.endstop_triggered(_AXIS(AXIS)); \
266
         stepper.endstop_triggered(_AXIS(AXIS)); \
267
-        CODE; \
268
       } \
267
       } \
269
     } while(0)
268
     } while(0)
270
 
269
 
271
-  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN)  // If G38 command then check Z_MIN for every axis and every direction
272
-
273
-    #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
274
-        _UPDATE_ENDSTOP(AXIS,MINMAX,NOOP); \
275
-        if (G38_move) _UPDATE_ENDSTOP(Z, MIN, G38_endstop_hit = true); \
276
-      } while(0)
277
-
278
-  #else
279
-
280
-    #define UPDATE_ENDSTOP(AXIS,MINMAX) _UPDATE_ENDSTOP(AXIS,MINMAX,NOOP)
281
-
270
+  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
271
+  // If G38 command then check Z_MIN_PROBE for every axis and every direction
272
+    if (G38_move) {
273
+      UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
274
+      if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
275
+        if      (stepper.current_block->steps[_AXIS(X)] > 0) {_ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X));}
276
+        else if (stepper.current_block->steps[_AXIS(Y)] > 0) {_ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y));}
277
+        else if (stepper.current_block->steps[_AXIS(Z)] > 0) {_ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z));}
278
+        G38_endstop_hit = true;
279
+      }
280
+    }
282
   #endif
281
   #endif
283
 
282
 
284
   #if CORE_IS_XY || CORE_IS_XZ
283
   #if CORE_IS_XY || CORE_IS_XZ

+ 1
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/Felix/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/Hephestos_2/Configuration_adv.h Datei anzeigen

622
 //#define BEZIER_CURVE_SUPPORT
622
 //#define BEZIER_CURVE_SUPPORT
623
 
623
 
624
 // G38.2 and G38.3 Probe Target
624
 // G38.2 and G38.3 Probe Target
625
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
625
 //#define G38_PROBE_TARGET
626
 //#define G38_PROBE_TARGET
626
 #if ENABLED(G38_PROBE_TARGET)
627
 #if ENABLED(G38_PROBE_TARGET)
627
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
628
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/K8200/Configuration_adv.h Datei anzeigen

652
 //#define BEZIER_CURVE_SUPPORT
652
 //#define BEZIER_CURVE_SUPPORT
653
 
653
 
654
 // G38.2 and G38.3 Probe Target
654
 // G38.2 and G38.3 Probe Target
655
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
655
 //#define G38_PROBE_TARGET
656
 //#define G38_PROBE_TARGET
656
 #if ENABLED(G38_PROBE_TARGET)
657
 #if ENABLED(G38_PROBE_TARGET)
657
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
658
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/K8400/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/TAZ4/Configuration_adv.h Datei anzeigen

647
 //#define BEZIER_CURVE_SUPPORT
647
 //#define BEZIER_CURVE_SUPPORT
648
 
648
 
649
 // G38.2 and G38.3 Probe Target
649
 // G38.2 and G38.3 Probe Target
650
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
650
 //#define G38_PROBE_TARGET
651
 //#define G38_PROBE_TARGET
651
 #if ENABLED(G38_PROBE_TARGET)
652
 #if ENABLED(G38_PROBE_TARGET)
652
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
653
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h Datei anzeigen

641
 //#define BEZIER_CURVE_SUPPORT
641
 //#define BEZIER_CURVE_SUPPORT
642
 
642
 
643
 // G38.2 and G38.3 Probe Target
643
 // G38.2 and G38.3 Probe Target
644
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
644
 //#define G38_PROBE_TARGET
645
 //#define G38_PROBE_TARGET
645
 #if ENABLED(G38_PROBE_TARGET)
646
 #if ENABLED(G38_PROBE_TARGET)
646
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
647
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h Datei anzeigen

641
 //#define BEZIER_CURVE_SUPPORT
641
 //#define BEZIER_CURVE_SUPPORT
642
 
642
 
643
 // G38.2 and G38.3 Probe Target
643
 // G38.2 and G38.3 Probe Target
644
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
644
 //#define G38_PROBE_TARGET
645
 //#define G38_PROBE_TARGET
645
 #if ENABLED(G38_PROBE_TARGET)
646
 #if ENABLED(G38_PROBE_TARGET)
646
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
647
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h Datei anzeigen

646
 //#define BEZIER_CURVE_SUPPORT
646
 //#define BEZIER_CURVE_SUPPORT
647
 
647
 
648
 // G38.2 and G38.3 Probe Target
648
 // G38.2 and G38.3 Probe Target
649
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
649
 //#define G38_PROBE_TARGET
650
 //#define G38_PROBE_TARGET
650
 #if ENABLED(G38_PROBE_TARGET)
651
 #if ENABLED(G38_PROBE_TARGET)
651
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
652
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h Datei anzeigen

641
 //#define BEZIER_CURVE_SUPPORT
641
 //#define BEZIER_CURVE_SUPPORT
642
 
642
 
643
 // G38.2 and G38.3 Probe Target
643
 // G38.2 and G38.3 Probe Target
644
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
644
 //#define G38_PROBE_TARGET
645
 //#define G38_PROBE_TARGET
645
 #if ENABLED(G38_PROBE_TARGET)
646
 #if ENABLED(G38_PROBE_TARGET)
646
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
647
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/makibox/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

+ 1
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h Datei anzeigen

639
 //#define BEZIER_CURVE_SUPPORT
639
 //#define BEZIER_CURVE_SUPPORT
640
 
640
 
641
 // G38.2 and G38.3 Probe Target
641
 // G38.2 and G38.3 Probe Target
642
+// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
642
 //#define G38_PROBE_TARGET
643
 //#define G38_PROBE_TARGET
643
 #if ENABLED(G38_PROBE_TARGET)
644
 #if ENABLED(G38_PROBE_TARGET)
644
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
645
   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

Laden…
Abbrechen
Speichern