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

The selector model - handles asynchronnous move operations between filament individual slots and keeps track of selector's current state. More...

#include <selector.h>

Inheritance diagram for modules::selector::Selector:
Inheritance graph
[legend]
Collaboration diagram for modules::selector::Selector:
Collaboration graph
[legend]

Public Member Functions

OperationResult MoveToSlot (uint8_t slot)
 
bool Step ()
 
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::S_pos_t SlotPosition (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
 
- Protected Member Functions inherited from modules::motion::MovableBase
virtual bool StallGuardAllowed (bool forward) const
 
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 selector model - handles asynchronnous move operations between filament individual slots and keeps track of selector's current state.

Member Function Documentation

◆ FinishHomingAndPlanMoveToParkPos()

bool modules::selector::Selector::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::selector::Selector::IdleSlotIndex ( )
inlinestaticconstexpr
Returns
the index of idle position of the selector, usually 5 in case of 0-4 valid indices of filament slots

◆ Init()

void modules::selector::Selector::Init ( )

Initializes the selector after restart/cold boot Reads the active slot from the EEPROM and decides if the selector is free or blocked by a piece of filament

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

◆ MoveToSlot()

Selector::OperationResult modules::selector::Selector::MoveToSlot ( uint8_t  slot)

Plan move of the selector to a specific filament slot

Parameters
slotindex to move to
Returns
false in case an operation is already underway
Note
if(state==OnHold) all attempts to move the selector are rejected with OperationResult::Rejected

◆ SlotPosition()

static constexpr mm::S_pos_t modules::selector::Selector::SlotPosition ( uint8_t  slot)
inlinestaticconstexpr
Returns
predefined positions of individual slots

◆ Step()

bool modules::selector::Selector::Step ( )

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

Returns
true if the selector 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: