Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
modules::idler::Idler Class Reference

The Idler model handles asynchronnous Engaging / Disengaging operations and keeps track of idler's current state. More...

#include <idler.h>

Inheritance diagram for modules::idler::Idler:
Inheritance graph
[legend]
Collaboration diagram for modules::idler::Idler:
Collaboration graph
[legend]

Public Member Functions

OperationResult Engage (uint8_t slot)
 
OperationResult Disengage ()
 
OperationResult PartiallyDisengage (uint8_t slot)
 
bool Step ()
 
bool Engaged () const
 
bool Disengaged () const
 
bool PartiallyDisengaged () const
 
void Init ()
 
- Public Member Functions inherited from modules::motion::MovableBase
constexpr MovableBase (config::Axis axis)
 
uint8_t Slot () const
 virtual ~MovableBase(); intentionally disabled, see description in logic::CommandBase More...
 
uint8_t State () const
 
hal::tmc2130::ErrorFlags TMCErrorFlags () const
 
void InvalidateHoming ()
 
OperationResult PlanHome ()
 
bool HomingValid () const
 
config::Axis Axis () const
 
void SetCurrents (uint8_t iRun, uint8_t iHold)
 
void HoldOn ()
 
bool IsOnHold () const
 
void Resume ()
 Allows the movable to move/home again after begin suspended by HoldOn.
 

Static Public Member Functions

static constexpr mm::I_pos_t SlotPosition (uint8_t slot)
 
static constexpr mm::I_pos_t IntermediateSlotPosition (uint8_t slot)
 
static constexpr uint8_t IdleSlotIndex ()
 

Protected Member Functions

virtual void PrepareMoveToPlannedSlot () override
 
virtual void PlanHomingMoveForward () override
 
virtual void PlanHomingMoveBack () override
 
virtual bool FinishHomingAndPlanMoveToParkPos () override
 
virtual void FinishMove () override
 
virtual bool StallGuardAllowed (bool forward) const override
 
- Protected Member Functions inherited from modules::motion::MovableBase
OperationResult InitMovement ()
 
OperationResult InitMovementNoReinitAxis ()
 Initializes movement of a movable module without reinitializing the axis/TMC driver.
 
void PerformMove ()
 
void PerformHomeForward ()
 
void PerformHomeBack ()
 
void HomeFailed ()
 
void CheckTMC ()
 
uint16_t AxisDistance (int32_t curPos) const
 

Additional Inherited Members

- Public Types inherited from modules::motion::MovableBase
enum  {
  Ready = 0 , Moving = 1 , PlannedHome = 2 , HomeForward = 3 ,
  HomeBack = 4 , TMCFailed = 5 , HomingFailed = 6 , OnHold = 0x80
}
 Internal states of the state machine. More...
 
enum class  OperationResult : uint8_t { Accepted , Refused , Failed }
 Operation (Engage/Disengage/MoveToSlot) return values. More...
 
- Protected Attributes inherited from modules::motion::MovableBase
uint8_t state
 internal state of the automaton
 
uint8_t plannedSlot
 planned slot - where to move to
 
uint8_t currentSlot
 current slot
 
bool homingValid
 true if the axis is considered as homed
 
hal::tmc2130::ErrorFlags tmcErrorFlags
 cached TMC2130 error flags - being read only if the axis is enabled and doing something (moving)
 
config::Axis axis
 
int32_t axisStart
 

Detailed Description

The Idler model handles asynchronnous Engaging / Disengaging operations and keeps track of idler's current state.

Member Function Documentation

◆ Disengage()

Idler::OperationResult modules::idler::Idler::Disengage ( )

Plan disengaging of the idler, i.e. parking the idler

Returns
OperationResult
Note
if(state==OnHold) all attempts to Disengage are rejected with OperationResult::Rejected

◆ Engage()

Idler::OperationResult modules::idler::Idler::Engage ( uint8_t  slot)

Plan engaging of the idler to a specific filament slot

Parameters
slotindex to be activated
Returns
OperationResult
Note
if(state==OnHold) all attempts to Engage are rejected with OperationResult::Rejected

◆ Engaged()

bool modules::idler::Idler::Engaged ( ) const
inline
Returns
the current state of idler - engaged / disengaged / partially disengaged this state is updated only when a planned move is successfully finished, so it is safe for higher-level state machines to use this call as a waiting condition for the desired state of the idler

◆ FinishHomingAndPlanMoveToParkPos()

bool modules::idler::Idler::FinishHomingAndPlanMoveToParkPos ( )
overrideprotectedvirtual
Returns
true if the measured axis length is within the expected range, false otherwise

Implements modules::motion::MovableBase.

◆ IdleSlotIndex()

static constexpr uint8_t modules::idler::Idler::IdleSlotIndex ( )
inlinestaticconstexpr
Returns
the index of idle position of the idler, usually 5 in case of 0-4 valid indices of filament slots

◆ Init()

void modules::idler::Idler::Init ( )

Initializes the idler after restart/cold boot Reads the active slot from the EEPROM and decides if the idler is safe to move (not hold the filament while printing)

  • free -> home the idler
  • blocked -> set idler's position according to the active filament slot

◆ IntermediateSlotPosition()

static constexpr mm::I_pos_t modules::idler::Idler::IntermediateSlotPosition ( uint8_t  slot)
inlinestaticconstexpr
Returns
predefined intermediate positions between individual slots

◆ PartiallyDisengage()

Idler::OperationResult modules::idler::Idler::PartiallyDisengage ( uint8_t  slot)

Plan partial disengaging of the idler

Returns
OperationResult

◆ SlotPosition()

static constexpr mm::I_pos_t modules::idler::Idler::SlotPosition ( uint8_t  slot)
inlinestaticconstexpr
Returns
predefined positions of individual slots

◆ StallGuardAllowed()

bool modules::idler::Idler::StallGuardAllowed ( bool  forward) const
overrideprotectedvirtual
Returns
true if the StallGuard signal is to be considered while homing. It may sound counterintuitive, but due to SG/homing issues on the Idler, it needs to avoid processing the SG while rotating over the filament. The Idler must consider SG signal only when close to its real end stops. Selector considers the SG signal all the time while homing, therefore the default implementation is empty

Reimplemented from modules::motion::MovableBase.

◆ Step()

bool modules::idler::Idler::Step ( )

Performs one step of the state machine according to currently planned operation

Returns
true if the idler is ready to accept new commands (i.e. it has finished the last operation)

The documentation for this class was generated from the following files: