Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
Public Member Functions | List of all members
logic::SetMode Class Reference

Sets the mode of TMC2130 for all motors at once. In the original proposal, the M0/M1 message was declared as a query, since it can be processed immediately. The reality is a bit different - the TMC2130 driver cannot change from SpreadCycle into StealthMode while moving the motor, at least not without serious jerking in most cases. Therefore the M0/M1 messages were reconsidered into a command, because only one command at a time can be performed (regardless of how long it takes it to finish) - that implies no motor moves are being performed while M0/M1 is being applied. More...

#include <set_mode.h>

Inheritance diagram for logic::SetMode:
Inheritance graph
[legend]
Collaboration diagram for logic::SetMode:
Collaboration graph
[legend]

Public Member Functions

bool Reset (uint8_t param) override
 Restart the automaton.
 
bool StepInner () override
 
- Public Member Functions inherited from logic::CommandBase
bool Step ()
 
virtual ProgressCode State () const
 
ProgressCode TopLevelState () const
 
virtual ErrorCode Error () const
 
virtual ResultCode Result () const
 
void Panic (ErrorCode ec)
 

Additional Inherited Members

- Static Public Member Functions inherited from logic::CommandBase
static void InvalidateHoming ()
 Invalidates homing state on Idler and Selector - doesn't change anything about filament load status.
 
static void InvalidateHomingAndFilamentState ()
 
static void HoldIdlerSelector ()
 Put Idler and Selector on-hold - they shall not move (not even home) until ResumeIdlerSelector is called.
 
static void ResumeIdlerSelector ()
 Allow Idler and Selector to move/home again. Any move needs to be newly planned.
 
- Protected Member Functions inherited from logic::CommandBase
bool CheckToolIndex (uint8_t index)
 
bool WaitForModulesErrorRecovery ()
 
bool WaitForOneModuleErrorRecovery (ErrorCode iState, modules::motion::MovableBase &m, uint8_t axisMask)
 
void ErrDisengagingIdler ()
 Perform disengaging idler in ErrDisengagingIdler state.
 
void GoToErrDisengagingIdler (ErrorCode deferredEC)
 Transit the state machine into ErrDisengagingIdler.
 
void GoToErrEngagingIdler ()
 Transit the state machine into ErrEngagingIdler.
 
void FinishedOK ()
 Process end of command which finished OK.
 
- Protected Attributes inherited from logic::CommandBase
ProgressCode state
 current progress state of the state machine
 
ErrorCode error
 current error code
 
ErrorCode deferredErrorCode
 planned error code - occurs when doing GoToErrDisengagingIdler - after the idler disengaged, the error is set (not before)
 
ProgressCode stateBeforeModuleFailed
 saved state of the state machine before a common error happened
 
ErrorCode errorBeforeModuleFailed
 saved error of the state machine before a common error happened
 
uint8_t recoveringMovableErrorAxisMask
 

Detailed Description

Sets the mode of TMC2130 for all motors at once. In the original proposal, the M0/M1 message was declared as a query, since it can be processed immediately. The reality is a bit different - the TMC2130 driver cannot change from SpreadCycle into StealthMode while moving the motor, at least not without serious jerking in most cases. Therefore the M0/M1 messages were reconsidered into a command, because only one command at a time can be performed (regardless of how long it takes it to finish) - that implies no motor moves are being performed while M0/M1 is being applied.

Member Function Documentation

◆ StepInner()

bool logic::SetMode::StepInner ( )
inlineoverridevirtual
Returns
true if the state machine finished its job, false otherwise Since we perform the TMC2130 mode change in the Reset directly, the return is always true here (command finished ok)

Implements logic::CommandBase.


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