Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Status Message cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and EvilGremlin committed May 17, 2023
1 parent cc36db9 commit 8a7bdf4
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 40 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,10 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
manage_response(false, false);

if (recover) {
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
LCD_MESSAGE(MSG_MMU2_REMOVE_AND_CLICK);
mmu2_attn_buzz();
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_MMU2_EJECT_RECOVER), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
mmu2_attn_buzz(true);

Expand Down
15 changes: 8 additions & 7 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this

TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Load Filament")));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENTLOAD)));

#if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
Expand Down Expand Up @@ -465,7 +465,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool

// If axes don't need to home then the nozzle can park
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
TERN_(DWIN_LCD_PROUI, if (!do_park) ui.set_status(GET_TEXT_F(MSG_PARK_FAILED)));
if (!do_park) LCD_MESSAGE(MSG_PARK_FAILED);

#if ENABLED(DUAL_X_CARRIAGE)
const int8_t saved_ext = active_extruder;
Expand Down Expand Up @@ -554,9 +554,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep

TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));

TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING)));

TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_REHEATING));
LCD_MESSAGE(MSG_REHEATING);

// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
Expand All @@ -573,8 +571,11 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);

TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE)));
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_REHEATDONE));
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE));
#else
LCD_MESSAGE(MSG_REHEATDONE);
#endif

IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);

Expand Down
36 changes: 14 additions & 22 deletions Marlin/src/gcode/bedlevel/G26.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ float g26_random_deviation = 0.0;
*/
bool user_canceled() {
if (!ui.button_pressed()) return false; // Return if the button isn't pressed
ui.set_status(GET_TEXT_F(MSG_G26_CANCELED), 99);
TERN_(HAS_MARLINUI_MENU, ui.quick_feedback());
LCD_MESSAGE_MAX(MSG_G26_CANCELED);
ui.quick_feedback();
ui.wait_for_release();
return true;
}
Expand Down Expand Up @@ -321,11 +321,9 @@ typedef struct {
#if HAS_HEATED_BED

if (bed_temp > 25) {
#if HAS_WIRED_LCD
ui.set_status(GET_TEXT_F(MSG_G26_HEATING_BED), 99);
ui.quick_feedback();
TERN_(HAS_MARLINUI_MENU, ui.capture());
#endif
LCD_MESSAGE_MAX(MSG_G26_HEATING_BED);
ui.quick_feedback();
TERN_(HAS_MARLINUI_MENU, ui.capture());
thermalManager.setTargetBed(bed_temp);

// Wait for the temperature to stabilize
Expand All @@ -340,20 +338,16 @@ typedef struct {
#endif // HAS_HEATED_BED

// Start heating the active nozzle
#if HAS_WIRED_LCD
ui.set_status(GET_TEXT_F(MSG_G26_HEATING_NOZZLE), 99);
ui.quick_feedback();
#endif
LCD_MESSAGE_MAX(MSG_G26_HEATING_NOZZLE);
ui.quick_feedback();
thermalManager.setTargetHotend(hotend_temp, active_extruder);

// Wait for the temperature to stabilize
if (!thermalManager.wait_for_hotend(active_extruder, true OPTARG(G26_CLICK_CAN_CANCEL, true)))
return G26_ERR;

#if HAS_WIRED_LCD
ui.reset_status();
ui.quick_feedback();
#endif
ui.reset_status();
ui.completion_feedback();

return G26_OK;
}
Expand All @@ -371,7 +365,7 @@ typedef struct {

if (prime_flag == -1) { // The user wants to control how much filament gets purged
ui.capture();
ui.set_status(GET_TEXT_F(MSG_G26_MANUAL_PRIME), 99);
LCD_MESSAGE_MAX(MSG_G26_MANUAL_PRIME);
ui.chirp();

destination = current_position;
Expand All @@ -398,17 +392,15 @@ typedef struct {

ui.wait_for_release();

ui.set_status(GET_TEXT_F(MSG_G26_PRIME_DONE), 99);
LCD_MESSAGE_MAX(MSG_G26_PRIME_DONE);
ui.quick_feedback();
ui.release();
}
else
#endif
{
#if HAS_WIRED_LCD
ui.set_status(GET_TEXT_F(MSG_G26_FIXED_LENGTH), 99);
ui.quick_feedback();
#endif
LCD_MESSAGE_MAX(MSG_G26_FIXED_LENGTH);
ui.quick_feedback();
destination = current_position;
destination.e += prime_length;
prepare_internal_move_to_destination(fr_slow_e);
Expand Down Expand Up @@ -853,7 +845,7 @@ void GcodeSuite::G26() {
} while (--g26_repeats && location.valid());

LEAVE:
ui.set_status(GET_TEXT_F(MSG_G26_LEAVING), -1);
LCD_MESSAGE_MIN(MSG_G26_LEAVING);
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, ExtUI::G26_FINISH));

g26.retract_filament(destination);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/M48.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void GcodeSuite::M48() {
};

if (!probe.can_reach(test_position)) {
ui.set_status(GET_TEXT_F(MSG_M48_OUT_OF_BOUNDS), 99);
LCD_MESSAGE_MAX(MSG_M48_OUT_OF_BOUNDS);
SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
return;
}
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ namespace Language_en {
LSTR MSG_CHAMBER_COOLING = _UxGT("Chamber Cooling...");
LSTR MSG_LASER_COOLING = _UxGT("Laser Cooling...");
LSTR MSG_DELTA_CALIBRATE = _UxGT("Delta Calibration");
LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Delta Calibration in progress");
LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Calibrate X");
LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Calibrate Y");
LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Calibrate Z");
Expand Down Expand Up @@ -750,7 +751,8 @@ namespace Language_en {
LSTR MSG_MMU2_FILAMENT_N = _UxGT("Filament ~");
LSTR MSG_MMU2_RESET = _UxGT("Reset MMU");
LSTR MSG_MMU2_RESETTING = _UxGT("MMU Resetting...");
LSTR MSG_MMU2_EJECT_RECOVER = _UxGT("Remove, click");
LSTR MSG_MMU2_EJECT_RECOVER = _UxGT("MMU2 Eject Recover");
LSTR MSG_MMU2_REMOVE_AND_CLICK = _UxGT("Remove and click...");

LSTR MSG_MIX = _UxGT("Mix");
LSTR MSG_MIX_COMPONENT_N = _UxGT("Component =");
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void MarlinUI::init() {
#if HAS_MARLINUI_MENU
if (use_click()) {
#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
next_filament_display = millis() + 5000UL; // Show status message for 5s
pause_filament_display();
#endif
goto_screen(menu_main);
reinit_lcd(); // Revive a noisy shared SPI LCD
Expand Down Expand Up @@ -1592,7 +1592,7 @@ void MarlinUI::init() {
#endif

#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
next_filament_display = ms + 5000UL; // Show status message for 5s
pause_filament_display(ms); // Show status message for 5s
#endif

#endif
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ class MarlinUI {

#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
static millis_t next_filament_display;
static void pause_filament_display(const millis_t ms=millis()) { next_filament_display = ms + 5000UL; }
#endif

#if HAS_TOUCH_SLEEP
Expand All @@ -493,6 +494,11 @@ class MarlinUI {

static void status_screen();

#else

static void quick_feedback(const bool=true) {}
static void completion_feedback(const bool=true) {}

#endif

#if HAS_MARLINUI_U8GLIB
Expand Down Expand Up @@ -803,5 +809,7 @@ class MarlinUI {

#define LCD_MESSAGE_F(S) ui.set_status(F(S))
#define LCD_MESSAGE(M) ui.set_status(GET_TEXT_F(M))
#define LCD_MESSAGE_MIN(M) ui.set_status(GET_TEXT_F(M), -1)
#define LCD_MESSAGE_MAX(M) ui.set_status(GET_TEXT_F(M), 99)
#define LCD_ALERTMESSAGE_F(S) ui.set_alert_status(F(S))
#define LCD_ALERTMESSAGE(M) ui.set_alert_status(GET_TEXT_F(M))
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu_delta_calibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ void _man_probe_pt(const xy_pos_t &xy) {
float lcd_probe_pt(const xy_pos_t &xy) {
_man_probe_pt(xy);
ui.defer_status_screen();
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Delta Calibration in progress")));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_DELTA_CALIBRATION_IN_PROGRESS), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_DELTA_CALIBRATION_IN_PROGRESS)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ui.goto_previous_screen_no_defer();
return current_position.z;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ void MarlinSettings::postprocess() {
stored_ver[1] = '\0';
}
DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION));
LCD_MESSAGE(MSG_ERR_EEPROM_VERSION);
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_VERSION)));

IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
Expand Down Expand Up @@ -2662,7 +2662,7 @@ void MarlinSettings::postprocess() {
else if (working_crc != stored_crc) {
eeprom_error = true;
DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_ERR_EEPROM_CRC));
LCD_MESSAGE(MSG_ERR_EEPROM_CRC);
TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC)));
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
}
Expand Down

0 comments on commit 8a7bdf4

Please sign in to comment.