From c77b768fddb5f706f6e52154a7c02c556bbedcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 17 Apr 2022 14:00:41 +0000 Subject: [PATCH 1/3] Make M117 custom message persistant if print is paused If M117 is called before M601 then we would like the custom message to be visible on the LCD screen until the print is resumed. Change in memory: +10 bytes of flash Fixes #3316 --- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 14 ++++++++++---- Firmware/ultralcd.h | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c2623a3e0..caea1caca 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4272,7 +4272,7 @@ void process_commands() if (starpos != NULL) *(starpos) = '\0'; lcd_setstatus(strchr_pointer + 5); - custom_message_type = CustomMsg::MsgUpdate; + custom_message_type = CustomMsg::M117; } /*! diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index eb75daecb..bafaff270 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -676,6 +676,9 @@ void lcdui_print_status_line(void) case CustomMsg::Resuming: //Resuming lcd_puts_at_P(0, 3, _T(MSG_RESUMING_PRINT)); break; + case CustomMsg::M117: + lcd_print(lcd_status_message); + break; } } @@ -875,10 +878,13 @@ void lcd_commands() { if (!blocks_queued() && !homing_flag) { - lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 - lcd_commands_type = LcdCommands::Idle; - lcd_commands_step = 0; - long_pause(); + if (custom_message_type != CustomMsg::M117) + { + lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 + } + lcd_commands_type = LcdCommands::Idle; + lcd_commands_step = 0; + long_pause(); } } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 41181554c..a237dc558 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -122,7 +122,8 @@ enum class CustomMsg : uint_least8_t TempCompPreheat, //!< Temperature compensation preheat M0Wait, //!< M0/M1 Wait command working even from SD MsgUpdate, //!< Short message even while printing from SD - Resuming, //!< Resuming message + Resuming, //!< Resuming message + M117, //!< M117 Custom Message to be displayed }; extern CustomMsg custom_message_type; From 727060ddd83d536663372dda026b47eda3ebafd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 17 Apr 2022 15:01:48 +0000 Subject: [PATCH 2/3] Replace CustomMsg::MsgUpdate with CustomMsg::M117 MsgUpdate was only used with M117, renaming the message type to M117 may be more descriptive for current use case. --- Firmware/ultralcd.cpp | 5 +---- Firmware/ultralcd.h | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bafaff270..55ec0d1c1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -618,7 +618,7 @@ void lcdui_print_status_line(void) } } else { // Otherwise check for other special events switch (custom_message_type) { - case CustomMsg::MsgUpdate: //Short message even while printing from SD + case CustomMsg::M117: // M117 Set the status line message on the LCD case CustomMsg::Status: // Nothing special, print status message normally case CustomMsg::M0Wait: // M0/M1 Wait command working even from SD lcd_print(lcd_status_message); @@ -676,9 +676,6 @@ void lcdui_print_status_line(void) case CustomMsg::Resuming: //Resuming lcd_puts_at_P(0, 3, _T(MSG_RESUMING_PRINT)); break; - case CustomMsg::M117: - lcd_print(lcd_status_message); - break; } } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a237dc558..388c385c9 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -121,9 +121,8 @@ enum class CustomMsg : uint_least8_t TempCal, //!< PINDA temperature calibration TempCompPreheat, //!< Temperature compensation preheat M0Wait, //!< M0/M1 Wait command working even from SD - MsgUpdate, //!< Short message even while printing from SD + M117, //!< M117 Set the status line message on the LCD Resuming, //!< Resuming message - M117, //!< M117 Custom Message to be displayed }; extern CustomMsg custom_message_type; From bf38241afe1ab4ec46bb8ff78e2dbae9e18c8f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Mon, 18 Apr 2022 17:07:34 +0000 Subject: [PATCH 3/3] Make M117 message persistent when using G4 command This is also supported in Marlin 2 FW Fixes #1443 Fixes #2970 --- Firmware/Marlin_main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index caea1caca..94a05b6e2 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4939,7 +4939,13 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait - if(codenum != 0) LCD_MESSAGERPGM(_n("Sleep..."));////MSG_DWELL + if(codenum != 0) + { + if(custom_message_type != CustomMsg::M117) + { + LCD_MESSAGERPGM(_n("Sleep..."));////MSG_DWELL + } + } st_synchronize(); codenum += _millis(); // keep track of when we started waiting previous_millis_cmd.start();