Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#4365 from gudnimg/sync-with-32-bit
Browse files Browse the repository at this point in the history
Explicitly use `Buttons` namespace
  • Loading branch information
3d-gussner authored Sep 12, 2023
2 parents c84985e + e0269d6 commit ffbb720
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
20 changes: 10 additions & 10 deletions Firmware/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool MMU2::RetryIfPossible(uint16_t ec) {
if (logic.RetryAttempts()) {
SetButtonResponse(ButtonOperations::Retry);
// check, that Retry is actually allowed on that operation
if (ButtonAvailable(ec) != NoButton) {
if (ButtonAvailable(ec) != Buttons::NoButton) {
logic.SetInAutoRetry(true);
SERIAL_ECHOLNPGM("RetryButtonPressed");
// We don't decrement until the button is acknowledged by the MMU.
Expand Down Expand Up @@ -733,9 +733,9 @@ void MMU2::CheckUserInput() {
}

switch (btn) {
case Left:
case Middle:
case Right:
case Buttons::Left:
case Buttons::Middle:
case Buttons::Right:
SERIAL_ECHOPGM("CheckUserInput-btnLMR ");
SERIAL_ECHOLN(btn);
ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else...
Expand All @@ -757,22 +757,22 @@ void MMU2::CheckUserInput() {
break;
}
break;
case TuneMMU:
case Buttons::TuneMMU:
Tune();
break;
case Load:
case Eject:
case Buttons::Load:
case Buttons::Eject:
// High level operation
setPrinterButtonOperation(btn);
break;
case ResetMMU:
case Buttons::ResetMMU:
Reset(ResetPin); // we cannot do power cycle on the MK3
// ... but mmu2_power.cpp knows this and triggers a soft-reset instead.
break;
case DisableMMU:
case Buttons::DisableMMU:
Stop(); // Poweroff handles updating the EEPROM shutoff.
break;
case StopPrint:
case Buttons::StopPrint:
// @@TODO not sure if we shall handle this high level operation at this spot
break;
default:
Expand Down
34 changes: 17 additions & 17 deletions Firmware/mmu2_error_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ struct ResetOnExit {

Buttons ButtonPressed(uint16_t ec) {
if (buttonSelectedOperation == ButtonOperations::NoOperation) {
return NoButton; // no button
return Buttons::NoButton; // no button
}

ResetOnExit ros; // clear buttonSelectedOperation on exit from this call
Expand Down Expand Up @@ -214,7 +214,7 @@ Buttons ButtonAvailable(uint16_t ec) {
switch (buttonSelectedOperation) {
// may be allow move selector right and left in the future
case ButtonOperations::Retry: // "Repeat action"
return Middle;
return Buttons::Middle;
default:
break;
}
Expand All @@ -224,9 +224,9 @@ Buttons ButtonAvailable(uint16_t ec) {
switch (buttonSelectedOperation) {
// may be allow move selector right and left in the future
case ButtonOperations::Tune: // Tune Stallguard threshold
return TuneMMU;
return Buttons::TuneMMU;
case ButtonOperations::Retry: // "Repeat action"
return Middle;
return Buttons::Middle;
default:
break;
}
Expand All @@ -235,17 +235,17 @@ Buttons ButtonAvailable(uint16_t ec) {
case ERR_SYSTEM_FILAMENT_EJECTED:
switch (buttonSelectedOperation) {
case ButtonOperations::Continue: // User solved the serious mechanical problem by hand - there is no other way around
return Middle;
return Buttons::Middle;
default:
break;
}
break;
case ERR_SYSTEM_FILAMENT_CHANGE:
switch (buttonSelectedOperation) {
case ButtonOperations::Load:
return Load;
return Buttons::Load;
case ButtonOperations::Eject:
return Eject;
return Buttons::Eject;
default:
break;
}
Expand All @@ -255,9 +255,9 @@ Buttons ButtonAvailable(uint16_t ec) {
case ERR_TEMPERATURE_WARNING_TMC_IDLER_TOO_HOT:
switch (buttonSelectedOperation) {
case ButtonOperations::Continue: // "Continue"
return Left;
return Buttons::Left;
case ButtonOperations::ResetMMU: // "Reset MMU"
return ResetMMU;
return Buttons::ResetMMU;
default:
break;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ Buttons ButtonAvailable(uint16_t ec) {
case ERR_ELECTRICAL_MMU_MCU_ERROR:
switch (buttonSelectedOperation) {
case ButtonOperations::ResetMMU: // "Reset MMU"
return ResetMMU;
return Buttons::ResetMMU;
default:
break;
}
Expand All @@ -302,19 +302,19 @@ Buttons ButtonAvailable(uint16_t ec) {
case ERR_SYSTEM_FW_UPDATE_NEEDED:
switch (buttonSelectedOperation) {
case ButtonOperations::DisableMMU: // "Disable"
return DisableMMU;
return Buttons::DisableMMU;
case ButtonOperations::ResetMMU: // "ResetMMU"
return ResetMMU;
return Buttons::ResetMMU;
default:
break;
}
break;
case ERR_SYSTEM_FILAMENT_ALREADY_LOADED:
switch (buttonSelectedOperation) {
case ButtonOperations::Unload: // "Unload"
return Left;
return Buttons::Left;
case ButtonOperations::Continue: // "Proceed/Continue"
return Right;
return Buttons::Right;
default:
break;
}
Expand All @@ -323,9 +323,9 @@ Buttons ButtonAvailable(uint16_t ec) {
case ERR_SYSTEM_INVALID_TOOL:
switch (buttonSelectedOperation) {
case ButtonOperations::StopPrint: // "Stop print"
return StopPrint;
return Buttons::StopPrint;
case ButtonOperations::ResetMMU: // "Reset MMU"
return ResetMMU;
return Buttons::ResetMMU;
default:
break;
}
Expand All @@ -335,7 +335,7 @@ Buttons ButtonAvailable(uint16_t ec) {
break;
}

return NoButton;
return Buttons::NoButton;
}

void SetButtonResponse(ButtonOperations rsp){
Expand Down
2 changes: 1 addition & 1 deletion Firmware/mmu2_protocol_logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ ProtocolLogic::ProtocolLogic(MMU2Serial *uart, uint8_t extraLoadDistance, uint8_
, uart(uart)
, errorCode(ErrorCode::OK)
, progressCode(ProgressCode::OK)
, buttonCode(NoButton)
, buttonCode(Buttons::NoButton)
, lastFSensor((uint8_t)WhereIsFilament())
, regIndex(0)
, retryAttempts(MAX_RETRIES)
Expand Down

0 comments on commit ffbb720

Please sign in to comment.