Tweaks following PR thread

This commit is contained in:
InsanityAutomation
2020-12-05 17:25:28 -05:00
parent 750bc64202
commit f583d933eb
5 changed files with 27 additions and 26 deletions
+8 -8
View File
@@ -997,24 +997,24 @@
#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_NEEDS_ENABLE
#if ENABLED(PROBE_NEEDS_ENABLE)
#define PROBE_NEEDS_ENABLE_STATE LOW
//#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
#endif
//#define PROBE_ENABLE_PIN PC6 // Override default probe enable pin
// Probe requires Tare - Usefull for Strain guage or Piezo type probes which may see force from cabling or bowden tubes following moves
//#define PROBE_NEEDS_TARE
#if ENABLED(PROBE_NEEDS_TARE)
//#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
#define PROBE_TARE_STATE HIGH // State to write pin for tare
//#define PROBE_TARE_PIN PA5 // Override default Tare pin
#if ENABLED(PROBE_NEEDS_ENABLE)
#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_ENABLE_WINDOW
//#define PROBE_TARE_WHILE_INACTIVE
#endif
#endif
+6 -6
View File
@@ -284,7 +284,7 @@ void Endstops::init() {
SET_INPUT(PROBE_ENABLE_PIN)
#endif
#if ENABLED(PROBE_NEEDS_TARE)
#if ENABLED(PROBE_CAN_TARE
probe.tare_z_probe();
#endif
@@ -590,7 +590,7 @@ void Endstops::update() {
#endif
#endif
#if HAS_Z_MIN && !Z_SPI_SENSORLESS && DISABLED(PROBE_NEEDS_ENABLE)
#if HAS_Z_MIN && !Z_SPI_SENSORLESS && DISABLED(PROBE_ENABLED_INPUTT)
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_NEEDS_ENABLE)
#if HAS_CUSTOM_PROBE_PIN && DISABLED(PROBE_ENABLED_INPUTT)
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
#endif
#if ENABLED(PROBE_NEEDS_ENABLE)
#if ENABLED(PROBE_ENABLED_INPUTT)
#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_NEEDS_ENABLE_STATE))));
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN_PROBE) && (READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUTT_STATE))));
#else
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN) && (READ(PROBE_ENABLE_PIN) == PROBE_NEEDS_ENABLE_STATE))));
SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN) && (READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUTT_STATE))));
#endif
#endif
+3 -2
View File
@@ -1603,8 +1603,9 @@ void homeaxis(const AxisEnum axis) {
if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
#endif
#if ENABLED(PROBE_NEEDS_TARE)
if (probe.tare_z_probe()) return;
#if ENABLED(PROBE_CAN_TARE
if(axis == Z_AXIS)
if (probe.tare_z_probe()) return;
#endif
#if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM)
+9 -9
View File
@@ -479,10 +479,10 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
return !probe_triggered;
}
#if ENABLED(PROBE_NEEDS_TARE)
#if ENABLED(PROBE_CAN_TARE
bool Probe::tare_z_probe() {
#if ENABLED(PROBE_ENABLE_WINDOW)
if ((READ(PROBE_ENABLE_PIN) == PROBE_NEEDS_ENABLE_STATE)) {
#if ENABLED(PROBE_TARE_WHILE_INACTIVEACTIVE)
if ((READ(PROBE_ENABLE_PIN) == PROBE_ENABLED_INPUTT_STATE)) {
SERIAL_ECHOLN("Cannot tare probe, already Enabled");
return true;
}
@@ -513,8 +513,8 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
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) {
// Do a first probe at the fast speed
#if ENABLED(PROBE_NEEDS_TARE)
if(tare_z_probe()) return true;
#if ENABLED(PROBE_CAN_TARE
if(tare_z_probe()) return NAN;
#endif
const bool probe_fail = probe_down_to_z(z_probe_low_point, fr_mm_s), // No probe trigger?
@@ -530,7 +530,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#else
UNUSED(plbl);
#endif
return (int)(probe_fail || early_fail);
return (bool)(probe_fail || early_fail);
};
// Stop the probe before it goes too low to prevent damage.
@@ -541,8 +541,8 @@ 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_NEEDS_TARE)
if(tare_z_probe()) return true;
#if ENABLED(PROBE_CAN_TARE
if(tare_z_probe()) return NAN;
#endif
if (try_to_probe(PSTR("FAST"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST),
@@ -583,7 +583,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#endif
{
// Probe downward slowly to find the bed
#if ENABLED(PROBE_NEEDS_TARE)
#if ENABLED(PROBE_CAN_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_NEEDS_TARE)
#if ENABLED(PROBE_CAN_TARE)
static bool tare_z_probe();
#endif