Pārlūkot izejas kodu

General cleanup: pause, MarlinCore

Scott Lahteine 5 gadus atpakaļ
vecāks
revīzija
0eeb5e2a29
2 mainītis faili ar 11 papildinājumiem un 26 dzēšanām
  1. 1
    3
      Marlin/src/MarlinCore.cpp
  2. 10
    23
      Marlin/src/feature/pause.cpp

+ 1
- 3
Marlin/src/MarlinCore.cpp Parādīt failu

@@ -214,9 +214,7 @@ bool wait_for_heatup = true;
214 214
   bool wait_for_user; // = false;
215 215
 
216 216
   void wait_for_user_response(millis_t ms/*=0*/, const bool no_sleep/*=false*/) {
217
-    #if DISABLED(ADVANCED_PAUSE_FEATURE)
218
-      UNUSED(no_sleep);
219
-    #endif
217
+    TERN(ADVANCED_PAUSE_FEATURE,,UNUSED(no_sleep));
220 218
     KEEPALIVE_STATE(PAUSED_FOR_USER);
221 219
     wait_for_user = true;
222 220
     if (ms) ms += millis(); // expire time

+ 10
- 23
Marlin/src/feature/pause.cpp Parādīt failu

@@ -102,6 +102,8 @@ fil_change_settings_t fc_settings[EXTRUDERS];
102 102
       }
103 103
     }
104 104
   }
105
+#else
106
+  inline void filament_change_beep(const int8_t, const bool=false) {}
105 107
 #endif
106 108
 
107 109
 /**
@@ -148,9 +150,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
148 150
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
149 151
                    DXC_ARGS
150 152
 ) {
151
-  #if !HAS_LCD_MENU
152
-    UNUSED(show_lcd);
153
-  #endif
153
+  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
154 154
 
155 155
   if (!ensure_safe_temperature(mode)) {
156 156
     #if HAS_LCD_MENU
@@ -165,11 +165,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
165 165
     #endif
166 166
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
167 167
 
168
-    #if HAS_BUZZER
169
-      filament_change_beep(max_beep_count, true);
170
-    #else
171
-      UNUSED(max_beep_count);
172
-    #endif
168
+    filament_change_beep(max_beep_count, true);
173 169
 
174 170
     KEEPALIVE_STATE(PAUSED_FOR_USER);
175 171
     #if ENABLED(HOST_PROMPT_SUPPORT)
@@ -184,7 +180,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
184 180
     #endif
185 181
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
186 182
     while (wait_for_user) {
187
-      TERN_(HAS_BUZZER, filament_change_beep(max_beep_count));
183
+      filament_change_beep(max_beep_count);
188 184
       idle_no_sleep();
189 185
     }
190 186
   }
@@ -285,9 +281,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
285 281
                        , const float &mix_multiplier/*=1.0*/
286 282
                      #endif
287 283
 ) {
288
-  #if !HAS_LCD_MENU
289
-    UNUSED(show_lcd);
290
-  #endif
284
+  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
291 285
 
292 286
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
293 287
     constexpr float mix_multiplier = 1.0;
@@ -353,10 +347,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
353 347
 uint8_t did_pause_print = 0;
354 348
 
355 349
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
356
-
357
-  #if !HAS_LCD_MENU
358
-    UNUSED(show_lcd);
359
-  #endif
350
+  TERN(HAS_LCD_MENU,,UNUSED(show_lcd));
360 351
 
361 352
   if (did_pause_print) return false; // already paused
362 353
 
@@ -457,11 +448,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
457 448
 
458 449
   show_continue_prompt(is_reload);
459 450
 
460
-  #if HAS_BUZZER
461
-    filament_change_beep(max_beep_count, true);
462
-  #else
463
-    UNUSED(max_beep_count);
464
-  #endif
451
+  filament_change_beep(max_beep_count, true);
465 452
 
466 453
   // Start the heater idle timers
467 454
   const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
@@ -481,7 +468,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
481 468
   TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
482 469
   wait_for_user = true;    // LCD click or M108 will clear this
483 470
   while (wait_for_user) {
484
-    TERN_(HAS_BUZZER, filament_change_beep(max_beep_count));
471
+    filament_change_beep(max_beep_count);
485 472
 
486 473
     // If the nozzle has timed out...
487 474
     if (!nozzle_timed_out)
@@ -521,7 +508,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
521 508
       wait_for_user = true;
522 509
       nozzle_timed_out = false;
523 510
 
524
-      TERN_(HAS_BUZZER, filament_change_beep(max_beep_count, true));
511
+      filament_change_beep(max_beep_count, true);
525 512
     }
526 513
     idle_no_sleep();
527 514
   }

Notiek ielāde…
Atcelt
Saglabāt