Prusa3d Marlin fork
|
#include <mmu2.h>
Public Types | |
enum | ResetForm : uint8_t { Software = 0 , ResetPin = 1 , CutThePower = 2 , EraseEEPROM = 42 } |
Different levels of resetting the MMU. More... | |
enum | SavedState : uint8_t { None = 0 , ParkExtruder = 1 , Cooldown = 2 , CooldownPending = 4 } |
Saved print state on error. | |
enum | ErrorSource : uint8_t { ErrorSourcePrinter = 0 , ErrorSourceMMU = 1 , ErrorSourceNone = 0xFF } |
Source of operation error. | |
Public Member Functions | |
void | Start () |
Powers ON the MMU, then initializes the UART and protocol logic. | |
void | Stop () |
Stops the protocol logic, closes the UART, powers OFF the MMU. | |
void | Status () |
Serial output of MMU state. | |
xState | State () const |
bool | Enabled () const |
void | Tune () |
void | Reset (ResetForm level) |
void | PowerOff () |
Power off the MMU (cut the power) | |
void | PowerOn () |
Power on the MMU. | |
bool | ReadRegister (uint8_t address) |
bool | WriteRegister (uint8_t address, uint16_t data) |
void | mmu_loop () |
bool | tool_change (uint8_t slot) |
bool | tool_change (char code, uint8_t slot) |
Handling of special Tx, Tc, T? commands. More... | |
bool | unload () |
bool | load_filament (uint8_t slot) |
bool | load_filament_to_nozzle (uint8_t slot) |
bool | eject_filament (uint8_t slot, bool enableFullScreenMsg=true) |
bool | cut_filament (uint8_t slot, bool enableFullScreenMsg=true) |
void | get_statistics () |
Issue a planned request for statistics data from MMU. | |
bool | loading_test (uint8_t slot) |
uint8_t | get_current_tool () const |
uint8_t | get_tool_change_tool () const |
bool | set_filament_type (uint8_t slot, uint8_t type) |
void | Button (uint8_t index) |
void | Home (uint8_t mode) |
Issue an explicit "homing" command into the MMU. | |
bool | FindaDetectsFilament () const |
uint16_t | TotalFailStatistics () const |
ErrorCode | MMUCurrentErrorCode () const |
uint8_t | GetCommandInProgress () const |
ErrorSource | MMULastErrorSource () const |
ErrorCode | GetLastErrorCode () const |
Version | GetMMUFWVersion () const |
bool | MMU_PRINT_SAVED () const |
Method to read-only mmu_print_saved. | |
bool | RetryIfPossible (ErrorCode ec) |
uint16_t | ToolChangeCounter () const |
void | ClearToolChangeCounter () |
Set toolchange counter to zero. | |
uint16_t | TMCFailures () const |
void | IncrementTMCFailures () |
void | ClearTMCFailures () |
uint16_t | GetLastReadRegisterValue () const |
void | InvokeErrorScreen (ErrorCode ec) |
void | ClearPrinterError () |
void | SetPrinterButtonOperation (Buttons btn) |
Queue a button operation which the printer can act upon. More... | |
Buttons | GetPrinterButtonOperation () |
Get the printer button operation. More... | |
void | ClearPrinterButtonOperation () |
Top-level interface between Logic and Marlin. Intentionally named MMU2 to be (almost) a drop-in replacement for the previous implementation. Most of the public methods share the original naming convention as well.
enum MMU2::MMU2::ResetForm : uint8_t |
void MMU2::MMU2::Button | ( | uint8_t | index | ) |
Issue a "button" click into the MMU - to be used from Error screens of the MMU to select one of the 3 possible options to resolve the issue
bool MMU2::MMU2::cut_filament | ( | uint8_t | slot, |
bool | enableFullScreenMsg = true |
||
) |
Issue a Cut command into the MMU Requires unloaded filament from the printer (obviously)
bool MMU2::MMU2::eject_filament | ( | uint8_t | slot, |
bool | enableFullScreenMsg = true |
||
) |
Move MMU's selector aside and push the selected filament forward. Usable for improving filament's tip or pulling the remaining piece of filament out completely.
|
inline |
uint8_t MMU2::MMU2::get_current_tool | ( | ) | const |
uint8_t MMU2::MMU2::get_tool_change_tool | ( | ) | const |
|
inline |
|
inline |
|
inline |
Retrieve cached value parsed from ReadRegister() or using M707
|
inline |
|
inline |
bool MMU2::MMU2::load_filament | ( | uint8_t | slot | ) |
Load (insert) filament just into the MMU (not into printer's nozzle)
bool MMU2::MMU2::load_filament_to_nozzle | ( | uint8_t | slot | ) |
Load (push) filament from the MMU into the printer's nozzle
bool MMU2::MMU2::loading_test | ( | uint8_t | slot | ) |
Issue a Try-Load command It behaves very similarly like a ToolChange, but it doesn't load the filament all the way down to the nozzle. The sole purpose of this operation is to check, that the filament will be ready for printing.
slot | index of slot to be tested |
void MMU2::MMU2::mmu_loop | ( | ) |
The main loop of MMU processing. Doesn't loop (block) inside, performs just one step of logic state machines. Also, internally it prevents recursive entries.
|
inline |
|
inline |
bool MMU2::MMU2::ReadRegister | ( | uint8_t | address | ) |
Read from a MMU register (See gcode M707)
address | Address of register in hexidecimal |
void MMU2::MMU2::Reset | ( | ResetForm | level | ) |
Perform a reset of the MMU
level | physical form of the reset |
bool MMU2::MMU2::RetryIfPossible | ( | ErrorCode | ec | ) |
Automagically "press" a Retry button if we have any retry attempts left
ec | ErrorCode enum value |
|
inline |
btn | Button operation |
bool MMU2::MMU2::tool_change | ( | char | code, |
uint8_t | slot | ||
) |
Handle special T?/Tx/Tc commands
bool MMU2::MMU2::tool_change | ( | uint8_t | slot | ) |
The main MMU command - select a different slot
slot | of the slot to be selected |
IS_SD_PRINTING && !usb_timer.running()
|
inline |
void MMU2::MMU2::Tune | ( | ) |
Tune value in MMU registers as a way to recover from errors e.g. Idler Stallguard threshold
bool MMU2::MMU2::unload | ( | ) |
Unload of filament in collaboration with the MMU. That includes rotating the printer's extruder in order to release filament.
bool MMU2::MMU2::WriteRegister | ( | uint8_t | address, |
uint16_t | data | ||
) |
Write from a MMU register (See gcode M708)
address | Address of register in hexidecimal |
data | Data to write to register |