Merge 65251c47b8 into 48d4d920be
commit
eeab330894
|
|
@ -21,6 +21,7 @@ void Selector::PrepareMoveToPlannedSlot() {
|
||||||
|
|
||||||
void Selector::PlanHomingMoveForward() {
|
void Selector::PlanHomingMoveForward() {
|
||||||
state = PlannedHome;
|
state = PlannedHome;
|
||||||
|
plannedHomeTimer = 0; // reset timeout counter when entering PlannedHome
|
||||||
dbg_logic_P(PSTR("Plan Homing Selector Forward"));
|
dbg_logic_P(PSTR("Plan Homing Selector Forward"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,6 +111,13 @@ bool Selector::Step() {
|
||||||
state = HomeForward;
|
state = HomeForward;
|
||||||
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(-config::selectorLimits.lenght * 2),
|
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(-config::selectorLimits.lenght * 2),
|
||||||
mm::unitToAxisUnit<mm::S_speed_t>(mg::globals.SelectorHomingFeedrate_mm_s()));
|
mm::unitToAxisUnit<mm::S_speed_t>(mg::globals.SelectorHomingFeedrate_mm_s()));
|
||||||
|
} else if (++plannedHomeTimer >= 30000U) {
|
||||||
|
// Idler did not become homing-valid within ~30 000 main-loop iterations.
|
||||||
|
// This breaks a potential deadlock where the idler is stuck in a non-error
|
||||||
|
// state (e.g. Ready with homingValid==false) that WaitForModulesErrorRecovery
|
||||||
|
// cannot detect. HomeFailed() transitions selector to HomingFailed, which IS
|
||||||
|
// detected and surfaces an error screen to the user.
|
||||||
|
HomeFailed();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case HomeForward:
|
case HomeForward:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ namespace mm = modules::motion;
|
||||||
class Selector : public mm::MovableBase {
|
class Selector : public mm::MovableBase {
|
||||||
public:
|
public:
|
||||||
inline constexpr Selector()
|
inline constexpr Selector()
|
||||||
: MovableBase(mm::Selector) {}
|
: MovableBase(mm::Selector)
|
||||||
|
, plannedHomeTimer(0) {}
|
||||||
|
|
||||||
/// Plan move of the selector to a specific filament slot
|
/// Plan move of the selector to a specific filament slot
|
||||||
/// @param slot index to move to
|
/// @param slot index to move to
|
||||||
|
|
@ -49,6 +50,10 @@ protected:
|
||||||
virtual void FinishMove() override;
|
virtual void FinishMove() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// Counts main-loop iterations spent in PlannedHome while waiting for the idler to become HomingValid.
|
||||||
|
/// Guards against indefinite deadlock: if the idler never becomes valid, HomeFailed() fires and the
|
||||||
|
/// WaitForModulesErrorRecovery path surfaces the error to the user.
|
||||||
|
uint16_t plannedHomeTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The one and only instance of Selector in the FW
|
/// The one and only instance of Selector in the FW
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue