浏览代码

General cleanup: pause, MarlinCore

Scott Lahteine 5 年前
父节点
当前提交
0eeb5e2a29
共有 2 个文件被更改,包括 11 次插入26 次删除
  1. 1
    3
      Marlin/src/MarlinCore.cpp
  2. 10
    23
      Marlin/src/feature/pause.cpp

+ 1
- 3
Marlin/src/MarlinCore.cpp 查看文件

214
   bool wait_for_user; // = false;
214
   bool wait_for_user; // = false;
215
 
215
 
216
   void wait_for_user_response(millis_t ms/*=0*/, const bool no_sleep/*=false*/) {
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
     KEEPALIVE_STATE(PAUSED_FOR_USER);
218
     KEEPALIVE_STATE(PAUSED_FOR_USER);
221
     wait_for_user = true;
219
     wait_for_user = true;
222
     if (ms) ms += millis(); // expire time
220
     if (ms) ms += millis(); // expire time

+ 10
- 23
Marlin/src/feature/pause.cpp 查看文件

102
       }
102
       }
103
     }
103
     }
104
   }
104
   }
105
+#else
106
+  inline void filament_change_beep(const int8_t, const bool=false) {}
105
 #endif
107
 #endif
106
 
108
 
107
 /**
109
 /**
148
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
150
                    const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
149
                    DXC_ARGS
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
   if (!ensure_safe_temperature(mode)) {
155
   if (!ensure_safe_temperature(mode)) {
156
     #if HAS_LCD_MENU
156
     #if HAS_LCD_MENU
165
     #endif
165
     #endif
166
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
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
     KEEPALIVE_STATE(PAUSED_FOR_USER);
170
     KEEPALIVE_STATE(PAUSED_FOR_USER);
175
     #if ENABLED(HOST_PROMPT_SUPPORT)
171
     #if ENABLED(HOST_PROMPT_SUPPORT)
184
     #endif
180
     #endif
185
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
181
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
186
     while (wait_for_user) {
182
     while (wait_for_user) {
187
-      TERN_(HAS_BUZZER, filament_change_beep(max_beep_count));
183
+      filament_change_beep(max_beep_count);
188
       idle_no_sleep();
184
       idle_no_sleep();
189
     }
185
     }
190
   }
186
   }
285
                        , const float &mix_multiplier/*=1.0*/
281
                        , const float &mix_multiplier/*=1.0*/
286
                      #endif
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
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
286
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
293
     constexpr float mix_multiplier = 1.0;
287
     constexpr float mix_multiplier = 1.0;
353
 uint8_t did_pause_print = 0;
347
 uint8_t did_pause_print = 0;
354
 
348
 
355
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
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
   if (did_pause_print) return false; // already paused
352
   if (did_pause_print) return false; // already paused
362
 
353
 
457
 
448
 
458
   show_continue_prompt(is_reload);
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
   // Start the heater idle timers
453
   // Start the heater idle timers
467
   const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
454
   const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
481
   TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
468
   TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
482
   wait_for_user = true;    // LCD click or M108 will clear this
469
   wait_for_user = true;    // LCD click or M108 will clear this
483
   while (wait_for_user) {
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
     // If the nozzle has timed out...
473
     // If the nozzle has timed out...
487
     if (!nozzle_timed_out)
474
     if (!nozzle_timed_out)
521
       wait_for_user = true;
508
       wait_for_user = true;
522
       nozzle_timed_out = false;
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
     idle_no_sleep();
513
     idle_no_sleep();
527
   }
514
   }

正在加载...
取消
保存