This commit is contained in:
Jason Smith
2020-12-08 00:13:13 -08:00
parent 0653027c98
commit 0bf9f04a4d
6 changed files with 55 additions and 47 deletions
+16 -15
View File
@@ -996,25 +996,26 @@
// Feedrate (mm/min) for the "accurate" probe of each point
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
// For probes that require an explicit enable input such as feedback an arm is deployed or an opto switch reporting in-range
//#define PROBE_ENABLED_INPUT
#if ENABLED(PROBE_ENABLED_INPUT)
#define PROBE_ENABLED_INPUT_STATE LOW
//#define PROBE_ENABLE_PIN PC6 // Override default probe enable pin
// Fail to probe if the probe does not indicate itself as active.
// This may be a switch indicating proper deployment, or an optical switch to report the carriage is near the bed.
//#define PROBE_ACTIVE_INPUT
#if ENABLED(PROBE_ACTIVE_INPUT)
#define PROBE_ACTIVE_INPUT_STATE LOW // State indicating probe is active
//#define PROBE_ACTIVE_INPUT_PIN PC6 // Override default pin
#endif
// Probe requires Tare - Usefull for Strain guage or Piezo type probes which may see force from cabling or bowden tubes following moves
//#define PROBE_CAN_TARE
#if ENABLED(PROBE_CAN_TARE)
#define PROBE_TARE_TIME 200 // Time to hold tare pin
#define PROBE_TARE_DELAY 200 // Dwell following tare before continuing
// Probe should be tared prior to each probe
// Useful for strain or piezo sensors which must exclude strain such
// as that from cables or bowden cables pulling on the carriage.
//#define PROBE_TARE
#if ENABLED(PROBE_TARE)
#define PROBE_TARE_TIME 200 // Time to hold tare pin (milliseconds)
#define PROBE_TARE_DELAY 200 // Delay after tare before (milliseconds)
#define PROBE_TARE_STATE HIGH // State to write pin for tare
//#define PROBE_TARE_PIN PA5 // Override default Tare pin
//#define PROBE_TARE_PIN PA5 // Override default pin
#if ENABLED(PROBE_ENABLED_INPUT)
// Assume probe enable will come on in a Z window rather than detecting probe deployment.
// Useful when TARE can be assured outside enable range to avoid potential crash situations.
// Prevents tare unless enable switch is off
//#define PROBE_TARE_WHILE_INACTIVE
// Fail to tare/probe if PROBE_ACTIVE_INPUT reports the probe to be active
//#define PROBE_TARE_ONLY_WHILE_INACTIVE
#endif
#endif
+8 -8
View File
@@ -280,11 +280,11 @@ void Endstops::init() {
#endif
#endif
#if PIN_EXISTS(PROBE_ENABLE_PIN)
SET_INPUT(PROBE_ENABLE_PIN)
#if PIN_EXISTS(PROBE_ACTIVE_INPUT)
SET_INPUT(PROBE_ACTIVE_INPUT_PIN);
#endif
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
probe.tare_z_probe();
#endif
@@ -590,7 +590,7 @@ void Endstops::update() {
#endif
#endif
#if HAS_Z_MIN && !Z_SPI_SENSORLESS && DISABLED(PROBE_ENABLED_INPUT)
#if HAS_Z_MIN && !Z_SPI_SENSORLESS && DISABLED(PROBE_ACTIVE_INPUT)
UPDATE_ENDSTOP_BIT(Z, MIN);
#if ENABLED(Z_MULTI_ENDSTOPS)
#if HAS_Z2_MIN
@@ -616,16 +616,16 @@ void Endstops::update() {
#endif
// When closing the gap check the enabled probe
#if HAS_CUSTOM_PROBE_PIN && DISABLED(PROBE_ENABLED_INPUT)
#if HAS_CUSTOM_PROBE_PIN && DISABLED(PROBE_ACTIVE_INPUT)
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
#endif
#if ENABLED(PROBE_ENABLED_INPUT)
#if ENABLED(PROBE_ACTIVE_INPUT)
#if HAS_CUSTOM_PROBE_PIN
UPDATE_ENDSTOP_BIT(Z, MIN);
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN_PROBE) && (READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUT_STATE))));
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN_PROBE) && (READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE))));
#else
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN) && (READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUT_STATE))));
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN) && (READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE))));
#endif
#endif
+1 -1
View File
@@ -1603,7 +1603,7 @@ void homeaxis(const AxisEnum axis) {
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH)
if (bltouch.deploy()) return; // The initial DEPLOY
#endif
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
if (probe.tare_z_probe()) return;
#endif
}
+28 -21
View File
@@ -479,24 +479,31 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
return !probe_triggered;
}
#if ENABLED(PROBE_CAN_TARE)
bool Probe::tare_z_probe() {
#if ENABLED(PROBE_TARE_WHILE_INACTIVE)
if ((READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUT_STATE)) {
SERIAL_ECHOLN("Cannot tare probe, already Enabled");
return true;
}
#endif
#if ENABLED(PROBE_TARE)
/**
* @brief Tare the Z probe
*
* @details Signals to the probe to tare measurement
*
* @return TRUE if the tare cold not be completed
*/
bool Probe::tare_z_probe() {
#if ENABLED(PROBE_TARE_ONLY_WHILE_INACTIVE)
if ((READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE)) {
SERIAL_ECHOLN("Cannot tare probe, already active");
return true;
}
#endif
SERIAL_ECHOLN("Taring the probe");
WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
delay(PROBE_TARE_TIME);
WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
delay(PROBE_TARE_DELAY);
SERIAL_ECHOLN("Taring the probe");
WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
delay(PROBE_TARE_TIME);
WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
delay(PROBE_TARE_DELAY);
endstops.hit_on_purpose();
return false;
}
endstops.hit_on_purpose();
return false;
}
#endif
/**
@@ -510,10 +517,10 @@ bool Probe::tare_z_probe() {
float Probe::run_z_probe(const bool sanity_check/*=true*/) {
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) {
auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) -> bool {
// Do a first probe at the fast speed
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
if(tare_z_probe()) return NAN;
#endif
@@ -530,7 +537,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#else
UNUSED(plbl);
#endif
return (bool)(probe_fail || early_fail);
return probe_fail || early_fail;
};
// Stop the probe before it goes too low to prevent damage.
@@ -541,7 +548,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if TOTAL_PROBING == 2
// Do a first probe at the fast speed
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
if(tare_z_probe()) return NAN;
#endif
@@ -583,7 +590,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#endif
{
// Probe downward slowly to find the bed
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
if(tare_z_probe()) return true;
#endif
if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW),
+1 -1
View File
@@ -206,7 +206,7 @@ public:
static void set_probing_paused(const bool p);
#endif
#if ENABLED(PROBE_CAN_TARE)
#if ENABLED(PROBE_TARE)
static bool tare_z_probe();
#endif
+1 -1
View File
@@ -69,7 +69,7 @@
// Probe
//
#define PROBE_TARE_PIN PA5
#define PROBE_ENABLE_PIN PC6 // Optoswitch to Enable Z Probe
#define PROBE_ACTIVE_INPUT_PIN PC6 // Optoswitch to indicate probe is near bed (active)
//
// Steppers