Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
disable_e_steppers();
#endif
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false;
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
set_defer_return_to_status(false);
}
#endif
}
}
Expand Down
44 changes: 17 additions & 27 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fil_change_settings_t fc_settings[EXTRUDERS];
*
* Returns 'true' if heating was completed, 'false' for abort
*/
static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT) {
static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_SAME) {

#if ENABLED(PREVENT_COLD_EXTRUSION)
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
Expand Down Expand Up @@ -134,23 +134,16 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
DXC_ARGS
) {
#if DISABLED(ULTIPANEL)
UNUSED(show_lcd);
#endif

if (!ensure_safe_temperature(mode)) {
#if HAS_LCD_MENU
if (show_lcd) // Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS, mode);
#endif

return false;
}

if (pause_for_user) {
#if HAS_LCD_MENU
if (show_lcd) // Show "insert filament"
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
Expand All @@ -173,8 +166,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
}

#if HAS_LCD_MENU
if (show_lcd) // Show "wait for load" message
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
#else
UNUSED(show_lcd);
#endif

#if ENABLED(DUAL_X_CARRIAGE)
Expand Down Expand Up @@ -210,8 +204,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)

#if HAS_LCD_MENU
if (show_lcd)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE);
#endif

wait_for_user = true;
Expand All @@ -225,8 +218,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
if (purge_length > 0) {
// "Wait for filament purge"
#if HAS_LCD_MENU
if (show_lcd)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE, mode);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE);
#endif

// Extrude filament to get into hotend
Expand All @@ -238,7 +230,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
if (show_lcd) {
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION, mode);
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION);
while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true);
KEEPALIVE_STATE(IN_HANDLER);
}
Expand Down Expand Up @@ -273,18 +265,16 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
) {
if (!ensure_safe_temperature(mode)) {
#if HAS_LCD_MENU
if (show_lcd) // Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
#endif

return false;
}

#if DISABLED(ULTIPANEL)
UNUSED(show_lcd);
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode);
#else
if (show_lcd)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode);
UNUSED(show_lcd);
#endif

// Retract filament
Expand Down Expand Up @@ -343,8 +333,9 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
#endif

#if HAS_LCD_MENU
if (show_lcd) // Show initial message
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT);
#else
UNUSED(show_lcd);
#endif

if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
Expand Down Expand Up @@ -549,7 +540,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS);

#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); // "Wait for print to resume"
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME);
#endif

// Intelligent resuming
Expand Down Expand Up @@ -577,7 +568,6 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
#endif

#if HAS_LCD_MENU
// Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
#endif

Expand Down
7 changes: 2 additions & 5 deletions Marlin/src/feature/pause.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef struct {
#include "../libs/nozzle.h"

enum AdvancedPauseMode : char {
ADVANCED_PAUSE_MODE_SAME,
ADVANCED_PAUSE_MODE_PAUSE_PRINT,
ADVANCED_PAUSE_MODE_LOAD_FILAMENT,
ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT
Expand All @@ -48,11 +49,7 @@ enum AdvancedPauseMessage : char {
ADVANCED_PAUSE_MESSAGE_UNLOAD,
ADVANCED_PAUSE_MESSAGE_INSERT,
ADVANCED_PAUSE_MESSAGE_LOAD,
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE,
#else
ADVANCED_PAUSE_MESSAGE_PURGE,
#endif
ADVANCED_PAUSE_MESSAGE_PURGE,
ADVANCED_PAUSE_MESSAGE_OPTION,
ADVANCED_PAUSE_MESSAGE_RESUME,
ADVANCED_PAUSE_MESSAGE_STATUS,
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ void GcodeSuite::M18_M84() {
}

#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false;
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
set_defer_return_to_status(false);
}
#endif
}
}
4 changes: 2 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1115,8 +1115,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
* LCD_BED_LEVELING requirements
*/
#if ENABLED(LCD_BED_LEVELING)
#if DISABLED(ULTIPANEL)
#error "LCD_BED_LEVELING requires an LCD controller."
#if !HAS_LCD_MENU
#error "LCD_BED_LEVELING requires a programmable LCD controller."
#elif !(ENABLED(MESH_BED_LEVELING) || OLDSCHOOL_ABL)
#error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING."
#endif
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,10 @@
#define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for")
#define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge")
#endif
#ifndef MSG_FILAMENT_CHANGE_CONT_PURGE_1
#define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Click to finish")
#define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("filament purge")
#endif
#ifndef MSG_FILAMENT_CHANGE_RESUME_1
#define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print")
#define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume...")
Expand Down Expand Up @@ -1160,6 +1164,9 @@
#ifndef MSG_FILAMENT_CHANGE_PURGE_1
#define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...")
#endif
#ifndef MSG_FILAMENT_CHANGE_CONT_PURGE_1
#define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Click to finish")
#endif
#ifndef MSG_FILAMENT_CHANGE_RESUME_1
#define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...")
#endif
Expand Down
20 changes: 13 additions & 7 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ typedef struct {
} menuPosition;
menuPosition screen_history[6];
uint8_t screen_history_depth = 0;
bool screen_changed, defer_return_to_status;
bool screen_changed;

#if LCD_TIMEOUT_TO_STATUS
bool defer_return_to_status;
#endif

// Value Editing
PGM_P editLabel;
Expand Down Expand Up @@ -97,10 +101,12 @@ void lcd_goto_previous_menu() {
lcd_return_to_status();
}

void lcd_goto_previous_menu_no_defer() {
defer_return_to_status = false;
lcd_goto_previous_menu();
}
#if LCD_TIMEOUT_TO_STATUS
void lcd_goto_previous_menu_no_defer() {
set_defer_return_to_status(false);
lcd_goto_previous_menu();
}
#endif

////////////////////////////////////////////
/////////// Common Menu Actions ////////////
Expand Down Expand Up @@ -234,7 +240,7 @@ void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) {
currentScreen = screen;
encoderPosition = encoder;
if (screen == lcd_status_screen) {
defer_return_to_status = false;
set_defer_return_to_status(false);
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.lcd_map_control = false;
#endif
Expand Down Expand Up @@ -343,7 +349,7 @@ void lcd_completion_feedback(const bool good/*=true*/) {

void lcd_babystep_zoffset() {
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
defer_return_to_status = true;
set_defer_return_to_status(true);
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
const bool do_probe = (active_extruder == 0);
#else
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ void scroll_screen(const uint8_t limit, const bool is_menu);
bool use_click();
bool printer_busy();
void lcd_completion_feedback(const bool good=true);
void lcd_goto_previous_menu();
void lcd_goto_previous_menu_no_defer();
void lcd_save_previous_screen();
void lcd_goto_previous_menu();
#if LCD_TIMEOUT_TO_STATUS
void lcd_goto_previous_menu_no_defer();
#else
#define lcd_goto_previous_menu_no_defer() lcd_goto_previous_menu()
#endif

////////////////////////////////////////////
////////// Menu Item Numeric Types /////////
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_bed_corners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void _lcd_level_bed_corners_homing() {
}

void _lcd_level_bed_corners() {
defer_return_to_status = true;
set_defer_return_to_status(true);
if (!all_axes_known()) {
set_all_unhomed();
enqueue_and_echo_commands_P(PSTR("G28"));
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_bed_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
// Step 2: Continue Bed Leveling...
//
void _lcd_level_bed_continue() {
defer_return_to_status = true;
set_defer_return_to_status(true);
set_all_unhomed();
lcd_goto_screen(_lcd_level_bed_homing);
enqueue_and_echo_commands_P(PSTR("G28"));
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_delta_calibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void _man_probe_pt(const float &rx, const float &ry) {
float lcd_probe_pt(const float &rx, const float &ry) {
_man_probe_pt(rx, ry);
KEEPALIVE_STATE(PAUSED_FOR_USER);
defer_return_to_status = true;
set_defer_return_to_status(true);
wait_for_user = true;
while (wait_for_user) idle();
KEEPALIVE_STATE(IN_HANDLER);
Expand Down
71 changes: 32 additions & 39 deletions Marlin/src/lcd/menu/menu_filament.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,47 +458,40 @@ void lcd_advanced_pause_resume_message() {
}

void lcd_advanced_pause_purge_message() {
START_SCREEN();
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_1);
#ifdef MSG_FILAMENT_CHANGE_PURGE_2
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_2);
#ifdef MSG_FILAMENT_CHANGE_PURGE_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_3);
_lcd_advanced_pause_message(
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_1)
#ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_2
, PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_2)
#ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_3
, PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_3)
#endif
#endif
#else
PSTR(MSG_FILAMENT_CHANGE_PURGE_1)
#ifdef MSG_FILAMENT_CHANGE_PURGE_2
, PSTR(MSG_FILAMENT_CHANGE_PURGE_2)
#ifdef MSG_FILAMENT_CHANGE_PURGE_3
, PSTR(MSG_FILAMENT_CHANGE_PURGE_3)
#endif
#endif
#endif
#endif
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
#define _PURGE_BASE 3
#else
#define _PURGE_BASE 2
#endif
#if (_PURGE_BASE + defined(MSG_FILAMENT_CHANGE_PURGE_2) + defined(MSG_FILAMENT_CHANGE_PURGE_3)) < LCD_HEIGHT - 1
STATIC_ITEM(" ");
#endif
HOTEND_STATUS_ITEM();
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
STATIC_ITEM(MSG_USERWAIT);
#endif
END_SCREEN();
);
}

FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) {
switch (message) {
case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message;
case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message;
case ADVANCED_PAUSE_MESSAGE_WAITING: return lcd_advanced_pause_waiting_message;
case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message;
case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message;
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
case ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE:
#else
case ADVANCED_PAUSE_MESSAGE_PURGE:
#endif
return lcd_advanced_pause_purge_message;
case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message;
case ADVANCED_PAUSE_MESSAGE_HEAT: return lcd_advanced_pause_heat_message;
case ADVANCED_PAUSE_MESSAGE_HEATING: return lcd_advanced_pause_heating_message;
case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR;
return menu_advanced_pause_option;
case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message;
case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message;
case ADVANCED_PAUSE_MESSAGE_WAITING: return lcd_advanced_pause_waiting_message;
case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message;
case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message;
case ADVANCED_PAUSE_MESSAGE_PURGE: return lcd_advanced_pause_purge_message;
case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message;
case ADVANCED_PAUSE_MESSAGE_HEAT: return lcd_advanced_pause_heat_message;
case ADVANCED_PAUSE_MESSAGE_HEATING: return lcd_advanced_pause_heating_message;
case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR;
return menu_advanced_pause_option;
case ADVANCED_PAUSE_MESSAGE_STATUS:
default: break;
}
Expand All @@ -507,14 +500,14 @@ FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message)

void lcd_advanced_pause_show_message(
const AdvancedPauseMessage message,
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/,
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_SAME*/,
const uint8_t extruder/*=active_extruder*/
) {
advanced_pause_mode = mode;
if (mode != ADVANCED_PAUSE_MODE_SAME) advanced_pause_mode = mode;
hotend_status_extruder = extruder;
const screenFunc_t next_screen = ap_message_screen(message);
if (next_screen) {
defer_return_to_status = true;
set_defer_return_to_status(true);
lcd_goto_screen(next_screen);
}
else
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_job_recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void lcd_power_loss_recovery_cancel() {
}

void menu_job_recovery() {
defer_return_to_status = true;
set_defer_return_to_status(true);
START_MENU();
STATIC_ITEM(MSG_POWER_LOSS_RECOVERY);
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume);
Expand Down
Loading