Ignoring the diag pin (stallguard) completely in specified range

This seems to greatly improve overall homing reliability of Idler on MMUs which couldn't home with inserted filaments at all.
The only downside is the fact, that we may actually "home" a blocked Idler correctly.
pull/266/head
D.R.racer 2023-03-07 11:10:19 +01:00
parent f6b32cbfef
commit 8d40d39701
4 changed files with 22 additions and 11 deletions

View File

@ -74,6 +74,11 @@ void Idler::FinishMove() {
}
}
bool Idler::SGAllowed(bool forward) const {
const uint8_t checkDistance = forward ? 220 : 200;
return AxisDistance(mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>())) > checkDistance;
}
void Idler::UpdateAdaptiveSGTHRS(bool forward) {
// return;
const uint8_t checkDistance = forward ? 220 : 200;

View File

@ -72,6 +72,7 @@ protected:
virtual bool FinishHomingAndPlanMoveToParkPos() override;
virtual void FinishMove() override;
virtual void UpdateAdaptiveSGTHRS(bool forward) override;
virtual bool SGAllowed(bool forward) const override;
private:
enum class Operation : uint8_t {

View File

@ -69,9 +69,11 @@ void MovableBase::PerformHomeForward() {
if (mm::motion.StallGuard(axis)) {
// we have reached the front end of the axis - first part homed probably ok
mm::motion.StallGuardReset(axis);
if (SGAllowed(true)) {
mm::motion.AbortPlannedMoves(axis, true);
PlanHomingMoveBack();
state = HomeBack;
}
} else if (mm::motion.QueueEmpty(axis)) {
HomeFailed();
} else {
@ -83,6 +85,7 @@ void MovableBase::PerformHomeBack() {
if (mm::motion.StallGuard(axis)) {
// we have reached the back end of the axis - second part homed probably ok
mm::motion.StallGuardReset(axis);
if (SGAllowed(false)) {
mm::motion.AbortPlannedMoves(axis, true);
mm::motion.SetMode(axis, mg::globals.MotorsStealth() ? mm::Stealth : mm::Normal);
if (!FinishHomingAndPlanMoveToParkPos()) {
@ -92,6 +95,7 @@ void MovableBase::PerformHomeBack() {
homingValid = true;
// state = Ready; // not yet - we have to move to our parking or target position after homing the axis
}
}
} else if (mm::motion.QueueEmpty(axis)) {
HomeFailed();
} else {

View File

@ -112,6 +112,7 @@ protected:
/// default implementation is empty
virtual void UpdateAdaptiveSGTHRS(bool /*forward*/) {}
virtual bool SGAllowed(bool forward) const { return true; }
/// Initializes movement of a movable module.
/// Beware: this operation reinitializes the axis/TMC driver as well (may introduce axis creep as we have seen on the Idler)