Sync MK3<->MK4 MMU2 mmu2_mk4.h
This commit is contained in:
parent
075858c9fa
commit
be5523187b
|
|
@ -3327,10 +3327,10 @@ static void mmu_M600_filament_change_screen(uint8_t eject_slot) {
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity(true);
|
manage_inactivity(true);
|
||||||
|
|
||||||
btn = MMU2::mmu2.getPrinterButtonOperation();
|
btn = MMU2::mmu2.GetPrinterButtonOperation();
|
||||||
if (btn != MMU2::Buttons::NoButton)
|
if (btn != MMU2::Buttons::NoButton)
|
||||||
{
|
{
|
||||||
MMU2::mmu2.clearPrinterButtonOperation();
|
MMU2::mmu2.ClearPrinterButtonOperation();
|
||||||
|
|
||||||
if (btn == MMU2::Buttons::Eject) {
|
if (btn == MMU2::Buttons::Eject) {
|
||||||
if (eject_slot != (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
if (eject_slot != (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
||||||
|
|
|
||||||
|
|
@ -761,7 +761,7 @@ void MMU2::CheckUserInput() {
|
||||||
case Buttons::Load:
|
case Buttons::Load:
|
||||||
case Buttons::Eject:
|
case Buttons::Eject:
|
||||||
// High level operation
|
// High level operation
|
||||||
setPrinterButtonOperation(btn);
|
SetPrinterButtonOperation(btn);
|
||||||
break;
|
break;
|
||||||
case Buttons::ResetMMU:
|
case Buttons::ResetMMU:
|
||||||
Reset(ResetPin); // we cannot do power cycle on the MK3
|
Reset(ResetPin); // we cannot do power cycle on the MK3
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,11 @@
|
||||||
#include "mmu2_marlin.h"
|
#include "mmu2_marlin.h"
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include "mmu2_protocol_logic.h"
|
#include "mmu2_protocol_logic.h"
|
||||||
typedef float feedRate_t;
|
typedef float feedRate_t;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "protocol_logic.h"
|
#include "protocol_logic.h"
|
||||||
#include "../../Marlin/src/core/macros.h"
|
|
||||||
#include "../../Marlin/src/core/types.h"
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -48,9 +45,9 @@ public:
|
||||||
|
|
||||||
/// Different levels of resetting the MMU
|
/// Different levels of resetting the MMU
|
||||||
enum ResetForm : uint8_t {
|
enum ResetForm : uint8_t {
|
||||||
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
|
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
|
||||||
ResetPin = 1, ///< trigger the reset pin of the MMU
|
ResetPin = 1, ///< trigger the reset pin of the MMU
|
||||||
CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines)
|
CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines)
|
||||||
EraseEEPROM = 42, ///< erase MMU EEPROM and then perform a software reset
|
EraseEEPROM = 42, ///< erase MMU EEPROM and then perform a software reset
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -201,9 +198,9 @@ public:
|
||||||
};
|
};
|
||||||
inline void InvokeErrorScreen(ErrorCode ec) {
|
inline void InvokeErrorScreen(ErrorCode ec) {
|
||||||
// The printer may not raise an error when the MMU is busy
|
// The printer may not raise an error when the MMU is busy
|
||||||
if ( !logic.CommandInProgress() // MMU must not be busy
|
if (!logic.CommandInProgress() // MMU must not be busy
|
||||||
&& MMUCurrentErrorCode() == ErrorCode::OK // The protocol must not be in error state
|
&& MMUCurrentErrorCode() == ErrorCode::OK // The protocol must not be in error state
|
||||||
&& lastErrorCode != ec) // The error code is not a duplicate
|
&& lastErrorCode != ec) // The error code is not a duplicate
|
||||||
{
|
{
|
||||||
ReportError(ec, ErrorSource::ErrorSourcePrinter);
|
ReportError(ec, ErrorSource::ErrorSourcePrinter);
|
||||||
}
|
}
|
||||||
|
|
@ -217,21 +214,23 @@ public:
|
||||||
|
|
||||||
/// @brief Queue a button operation which the printer can act upon
|
/// @brief Queue a button operation which the printer can act upon
|
||||||
/// @param btn Button operation
|
/// @param btn Button operation
|
||||||
inline void setPrinterButtonOperation(Buttons btn) {
|
inline void SetPrinterButtonOperation(Buttons btn) {
|
||||||
printerButtonOperation = btn;
|
printerButtonOperation = btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get the printer button operation
|
/// @brief Get the printer button operation
|
||||||
/// @return currently set printer button operation, it can be NoButton if nothing is queued
|
/// @return currently set printer button operation, it can be NoButton if nothing is queued
|
||||||
inline Buttons getPrinterButtonOperation() {
|
inline Buttons GetPrinterButtonOperation() {
|
||||||
return printerButtonOperation;
|
return printerButtonOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void clearPrinterButtonOperation() {
|
inline void ClearPrinterButtonOperation() {
|
||||||
printerButtonOperation = Buttons::NoButton;
|
printerButtonOperation = Buttons::NoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef UNITTEST
|
||||||
private:
|
private:
|
||||||
|
#endif
|
||||||
/// Perform software self-reset of the MMU (sends an X0 command)
|
/// Perform software self-reset of the MMU (sends an X0 command)
|
||||||
void ResetX0();
|
void ResetX0();
|
||||||
|
|
||||||
|
|
@ -279,6 +278,11 @@ private:
|
||||||
|
|
||||||
/// Responds to a change of MMU's progress
|
/// Responds to a change of MMU's progress
|
||||||
/// - plans additional steps, e.g. starts the E-motor after fsensor trigger
|
/// - plans additional steps, e.g. starts the E-motor after fsensor trigger
|
||||||
|
/// The function is quite complex, because it needs to handle asynchronnous
|
||||||
|
/// progress and error reports coming from the MMU without an explicit command
|
||||||
|
/// - typically after MMU's start or after some HW issue on the MMU.
|
||||||
|
/// It must ensure, that calls to @ref ReportProgress and/or @ref ReportError are
|
||||||
|
/// only executed after @ref BeginReport has been called first.
|
||||||
void OnMMUProgressMsg(ProgressCode pc);
|
void OnMMUProgressMsg(ProgressCode pc);
|
||||||
/// Progress code changed - act accordingly
|
/// Progress code changed - act accordingly
|
||||||
void OnMMUProgressMsgChanged(ProgressCode pc);
|
void OnMMUProgressMsgChanged(ProgressCode pc);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue