Merge pull request #5678 from Bob-the-Kuhn/G38-optional-double-tap

G38 bug fix, made double touch optional & reverted to Z_MIN_PROBE
master
Scott Lahteine 7 years ago committed by GitHub
commit deaad78df9

@ -649,6 +649,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -61,7 +61,7 @@
* G30 - Single Z probe, probes bed at X Y location (defaults to current XY location) * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
* G31 - Dock sled (Z_PROBE_SLED only) * G31 - Dock sled (Z_PROBE_SLED only)
* G32 - Undock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only)
* G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes
* G90 - Use Absolute Coordinates * G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates * G91 - Use Relative Coordinates
* G92 - Set current position to coordinates given * G92 - Set current position to coordinates given
@ -4824,31 +4824,32 @@ inline void gcode_G28() {
set_current_from_steppers_for_axis(ALL_AXES); set_current_from_steppers_for_axis(ALL_AXES);
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
// Only do remaining moves if target was hit
if (G38_endstop_hit) { if (G38_endstop_hit) {
G38_pass_fail = true; G38_pass_fail = true;
// Move away by the retract distance #if ENABLED(PROBE_DOUBLE_TOUCH)
set_destination_to_current(); // Move away by the retract distance
LOOP_XYZ(i) destination[i] += retract_mm[i]; set_destination_to_current();
endstops.enable(false); LOOP_XYZ(i) destination[i] += retract_mm[i];
prepare_move_to_destination(); endstops.enable(false);
stepper.synchronize(); prepare_move_to_destination();
stepper.synchronize();
feedrate_mm_s /= 4; feedrate_mm_s /= 4;
// Bump the target more slowly // Bump the target more slowly
LOOP_XYZ(i) destination[i] -= retract_mm[i] * 2; LOOP_XYZ(i) destination[i] -= retract_mm[i] * 2;
endstops.enable(true); endstops.enable(true);
G38_move = true; G38_move = true;
prepare_move_to_destination(); prepare_move_to_destination();
stepper.synchronize(); stepper.synchronize();
G38_move = false; G38_move = false;
set_current_from_steppers_for_axis(ALL_AXES); set_current_from_steppers_for_axis(ALL_AXES);
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
#endif
} }
endstops.hit_on_purpose(); endstops.hit_on_purpose();
@ -4860,7 +4861,7 @@ inline void gcode_G28() {
* G38.2 - probe toward workpiece, stop on contact, signal error if failure * G38.2 - probe toward workpiece, stop on contact, signal error if failure
* G38.3 - probe toward workpiece, stop on contact * G38.3 - probe toward workpiece, stop on contact
* *
* Like G28 except uses Z min endstop for all axes * Like G28 except uses Z min probe for all axes
*/ */
inline void gcode_G38(bool is_38_2) { inline void gcode_G38(bool is_38_2) {
// Get X Y Z E F // Get X Y Z E F

@ -257,26 +257,25 @@ void Endstops::update() {
// COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
#define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT)) #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT))
#define _UPDATE_ENDSTOP(AXIS,MINMAX,CODE) do { \ #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \ UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && stepper.current_block->steps[_AXIS(AXIS)] > 0) { \ if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && stepper.current_block->steps[_AXIS(AXIS)] > 0) { \
_ENDSTOP_HIT(AXIS); \ _ENDSTOP_HIT(AXIS); \
stepper.endstop_triggered(_AXIS(AXIS)); \ stepper.endstop_triggered(_AXIS(AXIS)); \
CODE; \
} \ } \
} while(0) } while(0)
#if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN) // If G38 command then check Z_MIN for every axis and every direction #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
// If G38 command then check Z_MIN_PROBE for every axis and every direction
#define UPDATE_ENDSTOP(AXIS,MINMAX) do { \ if (G38_move) {
_UPDATE_ENDSTOP(AXIS,MINMAX,NOOP); \ UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
if (G38_move) _UPDATE_ENDSTOP(Z, MIN, G38_endstop_hit = true); \ if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
} while(0) if (stepper.current_block->steps[_AXIS(X)] > 0) {_ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X));}
else if (stepper.current_block->steps[_AXIS(Y)] > 0) {_ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y));}
#else else if (stepper.current_block->steps[_AXIS(Z)] > 0) {_ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z));}
G38_endstop_hit = true;
#define UPDATE_ENDSTOP(AXIS,MINMAX) _UPDATE_ENDSTOP(AXIS,MINMAX,NOOP) }
}
#endif #endif
#if CORE_IS_XY || CORE_IS_XZ #if CORE_IS_XY || CORE_IS_XZ

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -622,6 +622,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -652,6 +652,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -647,6 +647,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -641,6 +641,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -641,6 +641,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -646,6 +646,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -641,6 +641,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -639,6 +639,7 @@
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target // G38.2 and G38.3 Probe Target
// ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
//#define G38_PROBE_TARGET //#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

Loading…
Cancel
Save