Browse Source

🐛 Fix MMU2 buzz (#23943)

Followup to 89a9c3a391
ellensp 2 years ago
parent
commit
f1471c1549
No account linked to committer's email address
1 changed files with 14 additions and 11 deletions
  1. 14
    11
      Marlin/src/feature/mmu/mmu2.cpp

+ 14
- 11
Marlin/src/feature/mmu/mmu2.cpp View File

@@ -143,7 +143,10 @@ uint8_t MMU2::get_current_tool() {
143 143
   #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
144 144
 #endif
145 145
 
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
+}
147 150
 
148 151
 void MMU2::mmu_loop() {
149 152
 
@@ -819,7 +822,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
819 822
       }
820 823
 
821 824
       LCD_MESSAGE(MSG_MMU2_RESUMING);
822
-      ATTN_BUZZ(true);
825
+      mmu2_attn_buzz(true);
823 826
 
824 827
       #pragma GCC diagnostic push
825 828
       #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
@@ -901,7 +904,7 @@ void MMU2::load_filament(const uint8_t index) {
901 904
 
902 905
   command(MMU_CMD_L0 + index);
903 906
   manage_response(false, false);
904
-  ATTN_BUZZ();
907
+  mmu2_attn_buzz();
905 908
 }
906 909
 
907 910
 /**
@@ -912,7 +915,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
912 915
   if (!_enabled) return false;
913 916
 
914 917
   if (thermalManager.tooColdToExtrude(active_extruder)) {
915
-    ATTN_BUZZ();
918
+    mmu2_attn_buzz();
916 919
     LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
917 920
     return false;
918 921
   }
@@ -927,7 +930,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
927 930
     extruder = index;
928 931
     active_extruder = 0;
929 932
     load_to_nozzle();
930
-    ATTN_BUZZ();
933
+    mmu2_attn_buzz();
931 934
   }
932 935
   return success;
933 936
 }
@@ -948,7 +951,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
948 951
   if (!_enabled) return false;
949 952
 
950 953
   if (thermalManager.tooColdToExtrude(active_extruder)) {
951
-    ATTN_BUZZ();
954
+    mmu2_attn_buzz();
952 955
     LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
953 956
     return false;
954 957
   }
@@ -964,11 +967,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
964 967
 
965 968
   if (recover)  {
966 969
     LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
967
-    ATTN_BUZZ();
970
+    mmu2_attn_buzz();
968 971
     TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
969 972
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
970 973
     TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
971
-    ATTN_BUZZ(true);
974
+    mmu2_attn_buzz(true);
972 975
 
973 976
     command(MMU_CMD_R0);
974 977
     manage_response(false, false);
@@ -981,7 +984,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
981 984
 
982 985
   set_runout_valid(false);
983 986
 
984
-  ATTN_BUZZ();
987
+  mmu2_attn_buzz();
985 988
 
986 989
   stepper.disable_extruder();
987 990
 
@@ -996,7 +999,7 @@ bool MMU2::unload() {
996 999
   if (!_enabled) return false;
997 1000
 
998 1001
   if (thermalManager.tooColdToExtrude(active_extruder)) {
999
-    ATTN_BUZZ();
1002
+    mmu2_attn_buzz();
1000 1003
     LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
1001 1004
     return false;
1002 1005
   }
@@ -1007,7 +1010,7 @@ bool MMU2::unload() {
1007 1010
   command(MMU_CMD_U0);
1008 1011
   manage_response(false, true);
1009 1012
 
1010
-  ATTN_BUZZ();
1013
+  mmu2_attn_buzz();
1011 1014
 
1012 1015
   // no active tool
1013 1016
   extruder = MMU2_NO_TOOL;

Loading…
Cancel
Save