🐛 Fix MMU2 buzz (#23943)

Followup to 89a9c3a391
This commit is contained in:
ellensp 2022-03-26 14:03:43 +13:00 committed by Scott Lahteine
parent c89d0114ac
commit 3bce266ef7

View file

@ -143,7 +143,10 @@ uint8_t MMU2::get_current_tool() {
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE) #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#endif #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() { void MMU2::mmu_loop() {
@ -819,7 +822,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
} }
LCD_MESSAGE(MSG_MMU2_RESUMING); LCD_MESSAGE(MSG_MMU2_RESUMING);
ATTN_BUZZ(true); mmu2_attn_buzz(true);
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
@ -901,7 +904,7 @@ void MMU2::load_filament(const uint8_t index) {
command(MMU_CMD_L0 + index); command(MMU_CMD_L0 + index);
manage_response(false, false); manage_response(false, false);
ATTN_BUZZ(); mmu2_attn_buzz();
} }
/** /**
@ -912,7 +915,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
if (!_enabled) return false; if (!_enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) { if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ(); mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false; return false;
} }
@ -927,7 +930,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
extruder = index; extruder = index;
active_extruder = 0; active_extruder = 0;
load_to_nozzle(); load_to_nozzle();
ATTN_BUZZ(); mmu2_attn_buzz();
} }
return success; return success;
} }
@ -948,7 +951,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (!_enabled) return false; if (!_enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) { if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ(); mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false; return false;
} }
@ -964,11 +967,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (recover) { if (recover) {
LCD_MESSAGE(MSG_MMU2_EJECT_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_(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_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ATTN_BUZZ(true); mmu2_attn_buzz(true);
command(MMU_CMD_R0); command(MMU_CMD_R0);
manage_response(false, false); manage_response(false, false);
@ -981,7 +984,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
set_runout_valid(false); set_runout_valid(false);
ATTN_BUZZ(); mmu2_attn_buzz();
stepper.disable_extruder(); stepper.disable_extruder();
@ -996,7 +999,7 @@ bool MMU2::unload() {
if (!_enabled) return false; if (!_enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) { if (thermalManager.tooColdToExtrude(active_extruder)) {
ATTN_BUZZ(); mmu2_attn_buzz();
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD); LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
return false; return false;
} }
@ -1007,7 +1010,7 @@ bool MMU2::unload() {
command(MMU_CMD_U0); command(MMU_CMD_U0);
manage_response(false, true); manage_response(false, true);
ATTN_BUZZ(); mmu2_attn_buzz();
// no active tool // no active tool
extruder = MMU2_NO_TOOL; extruder = MMU2_NO_TOOL;