From 0eeb5e2a29f2f76f0e5eeff661d3161c2910736b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2020 12:31:21 -0500 Subject: [PATCH] General cleanup: pause, MarlinCore --- Marlin/src/MarlinCore.cpp | 4 +--- Marlin/src/feature/pause.cpp | 33 ++++++++++----------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 6dc76947e5..28a1b0c98f 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -214,9 +214,7 @@ bool wait_for_heatup = true; bool wait_for_user; // = false; void wait_for_user_response(millis_t ms/*=0*/, const bool no_sleep/*=false*/) { - #if DISABLED(ADVANCED_PAUSE_FEATURE) - UNUSED(no_sleep); - #endif + TERN(ADVANCED_PAUSE_FEATURE,,UNUSED(no_sleep)); KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; if (ms) ms += millis(); // expire time diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 396819324c..f3c57bc923 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -102,6 +102,8 @@ fil_change_settings_t fc_settings[EXTRUDERS]; } } } +#else + inline void filament_change_beep(const int8_t, const bool=false) {} #endif /** @@ -148,9 +150,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/ DXC_ARGS ) { - #if !HAS_LCD_MENU - UNUSED(show_lcd); - #endif + TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); if (!ensure_safe_temperature(mode)) { #if HAS_LCD_MENU @@ -165,11 +165,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT)); - #if HAS_BUZZER - filament_change_beep(max_beep_count, true); - #else - UNUSED(max_beep_count); - #endif + filament_change_beep(max_beep_count, true); KEEPALIVE_STATE(PAUSED_FOR_USER); #if ENABLED(HOST_PROMPT_SUPPORT) @@ -184,7 +180,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); while (wait_for_user) { - TERN_(HAS_BUZZER, filament_change_beep(max_beep_count)); + filament_change_beep(max_beep_count); idle_no_sleep(); } } @@ -285,9 +281,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, , const float &mix_multiplier/*=1.0*/ #endif ) { - #if !HAS_LCD_MENU - UNUSED(show_lcd); - #endif + TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) constexpr float mix_multiplier = 1.0; @@ -353,10 +347,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, uint8_t did_pause_print = 0; bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) { - - #if !HAS_LCD_MENU - UNUSED(show_lcd); - #endif + TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); if (did_pause_print) return false; // already paused @@ -457,11 +448,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep show_continue_prompt(is_reload); - #if HAS_BUZZER - filament_change_beep(max_beep_count, true); - #else - UNUSED(max_beep_count); - #endif + filament_change_beep(max_beep_count, true); // Start the heater idle timers 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 TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED))); wait_for_user = true; // LCD click or M108 will clear this while (wait_for_user) { - TERN_(HAS_BUZZER, filament_change_beep(max_beep_count)); + filament_change_beep(max_beep_count); // If the nozzle has timed out... if (!nozzle_timed_out) @@ -521,7 +508,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep wait_for_user = true; nozzle_timed_out = false; - TERN_(HAS_BUZZER, filament_change_beep(max_beep_count, true)); + filament_change_beep(max_beep_count, true); } idle_no_sleep(); }