Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
Classes | Typedefs | Enumerations | Functions | Variables
logic Namespace Reference

The logic namespace handles the application logic on top of the modules. More...

Classes

class  CommandBase
 Base class defining common API for high-level operations/commands/state machines. More...
 
class  CutFilament
 A high-level command state machine - handles the complex logic of cutting filament. More...
 
class  EjectFilament
 A high-level command state machine - handles the complex logic of ejecting filament. More...
 
struct  FeedToBondtech
 Feed filament to Bondtech gears of the printer. More...
 
struct  FeedToFinda
 Feed filament to FINDA. More...
 
class  Home
 A high-level command state machine - wrapps the rehoming procedure to be used from a printer. More...
 
class  HWSanity
 Performs a sanity check of the hardware at reset/boot. Checks the following: More...
 
class  LoadFilament
 A high-level command state machine - handles the complex logic of loading filament into a filament slot. More...
 
class  MoveSelector
 A high-level command state machine - wrapps the rehoming procedure to be used from a printer. More...
 
class  NoCommand
 A dummy No-command operation just to make the init of the firmware consistent (and cleaner code during processing). More...
 
struct  RetractFromFinda
 Retract filament from FINDA to PTFE. More...
 
class  SetMode
 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...
 
class  StartUp
 Firmware start up sequence with error handling & reporting. More...
 
class  ToolChange
 A high-level command state machine - handles the complex logic of tool change - which is basically a chain of an Unload and a Load operation. More...
 
class  UnloadFilament
 A high-level command state machine - handles the complex logic of unloading filament. More...
 
struct  UnloadToFinda
 Unload to FINDA "small" state machine. More...
 

Typedefs

using Axis = config::Axis
 
using TMC2130 = hal::tmc2130::TMC2130
 

Enumerations

enum  pin_bits { BIT_STEP = 0b001 , BIT_DIR = 0b010 , BIT_ENA = 0b100 }
 

Functions

ErrorCodeoperator|= (ErrorCode &a, ErrorCode b)
 
ErrorCode operator<< (ErrorCode a, uint8_t b)
 
static ErrorCode TMC2130ToErrorCode (const hal::tmc2130::ErrorFlags &ef)
 
ErrorCode __attribute__ ((noinline)) AddErrorAxisBit(ErrorCode ec
 
ErrorCode CheckMovable (const mm::MovableBase &m)
 
static ErrorCode WithoutAxisBits (ErrorCode ec)
 
ErrorCode AddErrorAxisBit (ErrorCode ec, uint8_t axis)
 

Variables

ErrorCode uint8_t axis
 
return ec = (ErrorCode::TMC_PULLEY_BIT << axis)
 
CutFilament cutFilament
 The one and only instance of CutFilament state machine in the FW.
 
EjectFilament ejectFilament
 The one and only instance of EjectFilament state machine in the FW.
 
Home home
 The one and only instance of Home state machine in the FW.
 
static constexpr uint8_t LED_WAIT_MS = 50U
 
static constexpr uint8_t TEST_PASSES = 3U
 
HWSanity hwSanity
 The one and only instance of hwSanity state machine in the FW.
 
LoadFilament loadFilament
 The one and only instance of LoadFilament state machine in the FW.
 
MoveSelector moveSelector
 The one and only instance of MoveSelector state machine in the FW.
 
NoCommand noCommand
 The one and only instance of NoCommand state machine in the FW.
 
SetMode setMode
 The one and only instance of NoCommand state machine in the FW.
 
StartUp startUp
 The one and only instance of StartUp state machine in the FW.
 
ToolChange toolChange
 The one and only instance of ToolChange state machine in the FW.
 
UnloadFilament unloadFilament
 The one and only instance of UnloadFilament state machine in the FW.
 

Detailed Description

The logic namespace handles the application logic on top of the modules.

Function Documentation

◆ AddErrorAxisBit()

ErrorCode logic::AddErrorAxisBit ( ErrorCode  ec,
uint8_t  axis 
)

Bitwise OR (ErrorCode::TMC_PULLEY_BIT << axis) into ec where axis ranges from 0 to 2

Variable Documentation

◆ axis

ErrorCode uint8_t logic::axis
Initial value:
{
static_assert((uint16_t)ErrorCode::TMC_PULLEY_BIT == 0x0040)
@ TMC_PULLEY_BIT
+64 TMC Pulley bit