diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-03-03 13:52:37 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-03-03 13:52:37 +0300 |
commit | f5b540bdca881d09fac7aecfbf4fefdbe0d48da0 (patch) | |
tree | 40c4c0bb32378ee33e53c251be74d4764d9df350 /src/Endstops/ZProbe.cpp | |
parent | 7a3045b53e3e303a988ce4565b2ac21206182ffb (diff) |
Got rid of "near endstop" status
Cherry picked from commit 165b178f7de75b1d00b26fec28f2a03fb36d6119
Diffstat (limited to 'src/Endstops/ZProbe.cpp')
-rw-r--r-- | src/Endstops/ZProbe.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/Endstops/ZProbe.cpp b/src/Endstops/ZProbe.cpp index ba9ea24c..4141d2a3 100644 --- a/src/Endstops/ZProbe.cpp +++ b/src/Endstops/ZProbe.cpp @@ -208,40 +208,26 @@ int ZProbe::GetSecondaryValues(int& v1) const noexcept } // Test whether we are at or near the stop -EndStopHit ZProbe::Stopped() const noexcept +bool ZProbe::Stopped() const noexcept { const int zProbeVal = GetReading(); - return (zProbeVal >= adcValue) ? EndStopHit::atStop - : (zProbeVal * 10 >= adcValue * 9) ? EndStopHit::nearStop // if we are at/above 90% of the target value - : EndStopHit::noStop; + return zProbeVal >= adcValue; } // Check whether the probe is triggered and return the action that should be performed. Called from the step ISR. EndstopHitDetails ZProbe::CheckTriggered(bool goingSlow) noexcept { - EndStopHit e = Stopped(); + bool b = Stopped(); if (misc.parts.probingAway) { - e = (e == EndStopHit::atStop) ? EndStopHit::noStop : EndStopHit::atStop; + b = !b; } EndstopHitDetails rslt; // initialised by default constructor - switch (e) + if (b) { - case EndStopHit::atStop: rslt.SetAction(EndstopHitAction::stopAll); rslt.isZProbe = true; - break; - - case EndStopHit::nearStop: - if (!goingSlow) - { - rslt.SetAction(EndstopHitAction::reduceSpeed); - } - break; - - default: - break; } return rslt; } |