More advanced pause tweaks (#12356)

* Followup to LCD_TIMEOUT_TO_STATUS=0
* Make continuous purge screen fit 20x4
* Unify purge message modes
* Preserve last-set pause header mode
2.0.x
Scott Lahteine 6 years ago committed by GitHub
parent 5a470d4a49
commit e574f01568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}
}

@ -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)) {
@ -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);
@ -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)
@ -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;
@ -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
@ -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);
}
@ -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
@ -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)) {
@ -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
@ -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

@ -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
@ -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,

@ -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
}
}

@ -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

@ -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...")
@ -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

@ -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;
@ -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 ////////////
@ -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
@ -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

@ -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 /////////

@ -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"));

@ -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"));

@ -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);

@ -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;
}
@ -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

@ -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);

@ -241,7 +241,7 @@ inline void lcd_move_e() { _lcd_move_e(); }
screenFunc_t _manual_move_func_ptr;
void _goto_manual_move(const float scale) {
defer_return_to_status = true;
set_defer_return_to_status(true);
move_menu_scale = scale;
lcd_goto_screen(_manual_move_func_ptr);
}

@ -62,7 +62,7 @@ void lcd_sd_updir() {
#endif
lcd_goto_screen(menu_sdcard, last_sdfile_encoderPosition);
defer_return_to_status = true;
set_defer_return_to_status(true);
last_sdfile_encoderPosition = 0xFFFF;
#if HAS_GRAPHICAL_LCD

@ -78,13 +78,13 @@ void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); }
#if ENABLED(BABYSTEP_XY)
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
void lcd_babystep_x() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; defer_return_to_status = true; }
void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; defer_return_to_status = true; }
void lcd_babystep_x() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; set_defer_return_to_status(true); }
void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; set_defer_return_to_status(true); }
#endif
#if DISABLED(BABYSTEP_ZPROBE_OFFSET)
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; }
void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; set_defer_return_to_status(true); }
#endif
#endif // BABYSTEPPING

@ -51,7 +51,7 @@ float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5
static int16_t ubl_encoderPosition = 0;
static void _lcd_mesh_fine_tune(PGM_P msg) {
defer_return_to_status = true;
set_defer_return_to_status(true);
if (ubl.encoder_diff) {
ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
ubl.encoder_diff = 0;
@ -74,7 +74,7 @@ static void _lcd_mesh_fine_tune(PGM_P msg) {
}
void _lcd_mesh_edit_NOP() {
defer_return_to_status = true;
set_defer_return_to_status(true);
}
float lcd_mesh_edit() {
@ -408,7 +408,7 @@ void _lcd_ubl_storage_mesh() {
void _lcd_ubl_output_map_lcd();
void _lcd_ubl_map_homing() {
defer_return_to_status = true;
set_defer_return_to_status(true);
_lcd_draw_homing();
if (all_axes_homed()) {
ubl.lcd_map_control = true; // Return to the map screen

@ -281,7 +281,14 @@
extern screenFunc_t currentScreen;
void lcd_goto_screen(const screenFunc_t screen, const uint32_t encoder=0);
extern bool lcd_clicked, defer_return_to_status;
extern bool lcd_clicked;
#if LCD_TIMEOUT_TO_STATUS
extern bool defer_return_to_status;
inline void set_defer_return_to_status(const bool defer) { defer_return_to_status = defer; }
#else
constexpr bool defer_return_to_status = false;
#define set_defer_return_to_status(D) NOOP
#endif
extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
extern uint8_t lcd_preheat_fan_speed[2];
@ -309,7 +316,7 @@
#if ENABLED(ADVANCED_PAUSE_FEATURE)
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);
#endif

Loading…
Cancel
Save