Skip to content

Commit

Permalink
🐛 Fix MMU2 buzz (MarlinFirmware#23943)
Browse files Browse the repository at this point in the history
Followup to 89a9c3a
  • Loading branch information
ellensp authored Mar 26, 2022
1 parent 80c4abc commit f1471c1
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ uint8_t MMU2::get_current_tool() {
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#endif

inline void ATTN_BUZZ(const bool two=false) { BUZZ(200, 404); if (two) { BUZZ(10, 0); BUZZ(200, 404); } }
void mmu2_attn_buzz(const bool two=false) {
BUZZ(200, 404);
if (two) { BUZZ(10, 0); BUZZ(200, 404); }
}

void MMU2::mmu_loop() {

Expand Down Expand Up @@ -819,7 +822,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}

LCD_MESSAGE(MSG_MMU2_RESUMING);
ATTN_BUZZ(true);
mmu2_attn_buzz(true);

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
Expand Down Expand Up @@ -901,7 +904,7 @@ void MMU2::load_filament(const uint8_t index) {

command(MMU_CMD_L0 + index);
manage_response(false, false);
ATTN_BUZZ();
mmu2_attn_buzz();
}

/**
Expand All @@ -912,7 +915,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ();
mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}
Expand All @@ -927,7 +930,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
extruder = index;
active_extruder = 0;
load_to_nozzle();
ATTN_BUZZ();
mmu2_attn_buzz();
}
return success;
}
Expand All @@ -948,7 +951,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ();
mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}
Expand All @@ -964,11 +967,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {

if (recover) {
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
ATTN_BUZZ();
mmu2_attn_buzz();
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ATTN_BUZZ(true);
mmu2_attn_buzz(true);

command(MMU_CMD_R0);
manage_response(false, false);
Expand All @@ -981,7 +984,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {

set_runout_valid(false);

ATTN_BUZZ();
mmu2_attn_buzz();

stepper.disable_extruder();

Expand All @@ -996,7 +999,7 @@ bool MMU2::unload() {
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ();
mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false;
}
Expand All @@ -1007,7 +1010,7 @@ bool MMU2::unload() {
command(MMU_CMD_U0);
manage_response(false, true);

ATTN_BUZZ();
mmu2_attn_buzz();

// no active tool
extruder = MMU2_NO_TOOL;
Expand Down

0 comments on commit f1471c1

Please sign in to comment.