Skip to content

Commit f1471c1

Browse files
authored
🐛 Fix MMU2 buzz (MarlinFirmware#23943)
Followup to 89a9c3a
1 parent 80c4abc commit f1471c1

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Marlin/src/feature/mmu/mmu2.cpp

+14-11
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ uint8_t MMU2::get_current_tool() {
143143
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
144144
#endif
145145

146-
inline void ATTN_BUZZ(const bool two=false) { BUZZ(200, 404); if (two) { BUZZ(10, 0); BUZZ(200, 404); } }
146+
void mmu2_attn_buzz(const bool two=false) {
147+
BUZZ(200, 404);
148+
if (two) { BUZZ(10, 0); BUZZ(200, 404); }
149+
}
147150

148151
void MMU2::mmu_loop() {
149152

@@ -819,7 +822,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
819822
}
820823

821824
LCD_MESSAGE(MSG_MMU2_RESUMING);
822-
ATTN_BUZZ(true);
825+
mmu2_attn_buzz(true);
823826

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

902905
command(MMU_CMD_L0 + index);
903906
manage_response(false, false);
904-
ATTN_BUZZ();
907+
mmu2_attn_buzz();
905908
}
906909

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

914917
if (thermalManager.tooColdToExtrude(active_extruder)) {
915-
ATTN_BUZZ();
918+
mmu2_attn_buzz();
916919
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
917920
return false;
918921
}
@@ -927,7 +930,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
927930
extruder = index;
928931
active_extruder = 0;
929932
load_to_nozzle();
930-
ATTN_BUZZ();
933+
mmu2_attn_buzz();
931934
}
932935
return success;
933936
}
@@ -948,7 +951,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
948951
if (!_enabled) return false;
949952

950953
if (thermalManager.tooColdToExtrude(active_extruder)) {
951-
ATTN_BUZZ();
954+
mmu2_attn_buzz();
952955
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
953956
return false;
954957
}
@@ -964,11 +967,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
964967

965968
if (recover) {
966969
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
967-
ATTN_BUZZ();
970+
mmu2_attn_buzz();
968971
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
969972
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
970973
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
971-
ATTN_BUZZ(true);
974+
mmu2_attn_buzz(true);
972975

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

982985
set_runout_valid(false);
983986

984-
ATTN_BUZZ();
987+
mmu2_attn_buzz();
985988

986989
stepper.disable_extruder();
987990

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

9981001
if (thermalManager.tooColdToExtrude(active_extruder)) {
999-
ATTN_BUZZ();
1002+
mmu2_attn_buzz();
10001003
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
10011004
return false;
10021005
}
@@ -1007,7 +1010,7 @@ bool MMU2::unload() {
10071010
command(MMU_CMD_U0);
10081011
manage_response(false, true);
10091012

1010-
ATTN_BUZZ();
1013+
mmu2_attn_buzz();
10111014

10121015
// no active tool
10131016
extruder = MMU2_NO_TOOL;

0 commit comments

Comments
 (0)