Sync MK3<->MK4 MMU2 mmu2_mk4.h

This commit is contained in:
D.R.racer 2023-09-11 11:53:13 +02:00 committed by DRracer
parent 075858c9fa
commit be5523187b
3 changed files with 19 additions and 15 deletions

View File

@ -3327,10 +3327,10 @@ static void mmu_M600_filament_change_screen(uint8_t eject_slot) {
manage_heater();
manage_inactivity(true);
btn = MMU2::mmu2.getPrinterButtonOperation();
btn = MMU2::mmu2.GetPrinterButtonOperation();
if (btn != MMU2::Buttons::NoButton)
{
MMU2::mmu2.clearPrinterButtonOperation();
MMU2::mmu2.ClearPrinterButtonOperation();
if (btn == MMU2::Buttons::Eject) {
if (eject_slot != (uint8_t)MMU2::FILAMENT_UNKNOWN) {

View File

@ -761,7 +761,7 @@ void MMU2::CheckUserInput() {
case Buttons::Load:
case Buttons::Eject:
// High level operation
setPrinterButtonOperation(btn);
SetPrinterButtonOperation(btn);
break;
case Buttons::ResetMMU:
Reset(ResetPin); // we cannot do power cycle on the MK3

View File

@ -5,14 +5,11 @@
#include "mmu2_marlin.h"
#ifdef __AVR__
#include "mmu2_protocol_logic.h"
#include "mmu2_protocol_logic.h"
typedef float feedRate_t;
#else
#include "protocol_logic.h"
#include "../../Marlin/src/core/macros.h"
#include "../../Marlin/src/core/types.h"
#include <atomic>
#endif
@ -48,9 +45,9 @@ public:
/// Different levels of resetting the MMU
enum ResetForm : uint8_t {
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
ResetPin = 1, ///< trigger the reset pin of the MMU
CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines)
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
ResetPin = 1, ///< trigger the reset pin of the MMU
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
};
@ -201,9 +198,9 @@ public:
};
inline void InvokeErrorScreen(ErrorCode ec) {
// 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
&& lastErrorCode != ec) // The error code is not a duplicate
&& lastErrorCode != ec) // The error code is not a duplicate
{
ReportError(ec, ErrorSource::ErrorSourcePrinter);
}
@ -217,21 +214,23 @@ public:
/// @brief Queue a button operation which the printer can act upon
/// @param btn Button operation
inline void setPrinterButtonOperation(Buttons btn) {
inline void SetPrinterButtonOperation(Buttons btn) {
printerButtonOperation = btn;
}
/// @brief Get the printer button operation
/// @return currently set printer button operation, it can be NoButton if nothing is queued
inline Buttons getPrinterButtonOperation() {
inline Buttons GetPrinterButtonOperation() {
return printerButtonOperation;
}
inline void clearPrinterButtonOperation() {
inline void ClearPrinterButtonOperation() {
printerButtonOperation = Buttons::NoButton;
}
#ifndef UNITTEST
private:
#endif
/// Perform software self-reset of the MMU (sends an X0 command)
void ResetX0();
@ -279,6 +278,11 @@ private:
/// Responds to a change of MMU's progress
/// - 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);
/// Progress code changed - act accordingly
void OnMMUProgressMsgChanged(ProgressCode pc);