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) { void Idler::UpdateAdaptiveSGTHRS(bool forward) {
// return; // return;
const uint8_t checkDistance = forward ? 220 : 200; const uint8_t checkDistance = forward ? 220 : 200;

View File

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

View File

@ -69,9 +69,11 @@ void MovableBase::PerformHomeForward() {
if (mm::motion.StallGuard(axis)) { if (mm::motion.StallGuard(axis)) {
// we have reached the front end of the axis - first part homed probably ok // we have reached the front end of the axis - first part homed probably ok
mm::motion.StallGuardReset(axis); mm::motion.StallGuardReset(axis);
mm::motion.AbortPlannedMoves(axis, true); if (SGAllowed(true)) {
PlanHomingMoveBack(); mm::motion.AbortPlannedMoves(axis, true);
state = HomeBack; PlanHomingMoveBack();
state = HomeBack;
}
} else if (mm::motion.QueueEmpty(axis)) { } else if (mm::motion.QueueEmpty(axis)) {
HomeFailed(); HomeFailed();
} else { } else {
@ -83,14 +85,16 @@ void MovableBase::PerformHomeBack() {
if (mm::motion.StallGuard(axis)) { if (mm::motion.StallGuard(axis)) {
// we have reached the back end of the axis - second part homed probably ok // we have reached the back end of the axis - second part homed probably ok
mm::motion.StallGuardReset(axis); mm::motion.StallGuardReset(axis);
mm::motion.AbortPlannedMoves(axis, true); if (SGAllowed(false)) {
mm::motion.SetMode(axis, mg::globals.MotorsStealth() ? mm::Stealth : mm::Normal); mm::motion.AbortPlannedMoves(axis, true);
if (!FinishHomingAndPlanMoveToParkPos()) { mm::motion.SetMode(axis, mg::globals.MotorsStealth() ? mm::Stealth : mm::Normal);
// the measured axis' length was incorrect, something is blocking it, report an error, homing procedure terminated if (!FinishHomingAndPlanMoveToParkPos()) {
HomeFailed(); // the measured axis' length was incorrect, something is blocking it, report an error, homing procedure terminated
} else { HomeFailed();
homingValid = true; } else {
// state = Ready; // not yet - we have to move to our parking or target position after homing the axis 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)) { } else if (mm::motion.QueueEmpty(axis)) {
HomeFailed(); HomeFailed();

View File

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