From cb61436093238cd1a357dd248cd285e79e276542 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sun, 7 Feb 2021 09:47:30 +0100 Subject: [PATCH 01/15] Add remaining time to change/pause/user interaction to LCD Info screen - Add parameter `C` to gcode `M73` - LCD Info screen switches to change time if last `M73` gcode contains `C` parameter - Examples: - `M73 P5 R120` will display on LCD ` SD 5% 02:00R ` if it is printing at 100% speed - `M73 P5 R120 C60` will display on LCD ` SD 5% 01:00C ` if it is printing at 100% speed Slicers can generate "Time to change/pause/user interaction" using `C` parameter to "overwrite" the remaining print time. To switch between time to change and remaining time just send in intervals `M73` with or without `C` parameter. --- Firmware/Marlin.h | 2 ++ Firmware/Marlin_main.cpp | 33 ++++++++++++++++++++++++++++----- Firmware/ultralcd.cpp | 32 ++++++++++++++++++++------------ 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index cbe03c0f..5ef7ca00 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -366,6 +366,7 @@ extern uint8_t print_percent_done_normal; extern uint16_t print_time_remaining_normal; extern uint8_t print_percent_done_silent; extern uint16_t print_time_remaining_silent; +extern uint16_t print_time_to_change; #define PRINT_TIME_REMAINING_INIT 0xffff @@ -438,6 +439,7 @@ extern void cancel_saved_printing(); //estimated time to end of the print extern uint16_t print_time_remaining(); +extern uint16_t print_time_to_change_remaining(); extern uint8_t calc_percent_done(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0c468189..b36dd16a 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -316,6 +316,7 @@ uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT; uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT; uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes +uint16_t print_time_to_change = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes uint32_t IP_address = 0; @@ -6395,13 +6396,14 @@ Sigma_Exit: ### M73 - Set/get print progress M73: Set/Get build percentage #### Usage - M73 [ P | R | Q | S ] + M73 [ P | R | Q | S | C ] #### Parameters - `P` - Percent in normal mode - `R` - Time remaining in normal mode - `Q` - Percent in silent mode - `S` - Time in silent mode + - `C` - Time to change/pause/user interaction */ case 73: //M73 show percent done and time remaining if(code_seen('P')) print_percent_done_normal = code_value(); @@ -6414,6 +6416,14 @@ Sigma_Exit: printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal); printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent); } + + print_time_to_change = PRINT_TIME_REMAINING_INIT; + if(code_seen('C')) + { + print_time_to_change = code_value(); + printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change); + } + break; /*! @@ -11665,6 +11675,18 @@ uint16_t print_time_remaining() { return print_t; } +uint16_t print_time_to_change_remaining() { + uint16_t print_t = PRINT_TIME_REMAINING_INIT; +//#ifdef TMC2130 +// if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; +// else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); +//#else + print_t = print_time_to_change; +//#endif //TMC2130 + if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; + return print_t; +} + uint8_t calc_percent_done() { //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize @@ -11689,10 +11711,11 @@ uint8_t calc_percent_done() static void print_time_remaining_init() { - print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; - print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; - print_percent_done_normal = PRINT_PERCENT_DONE_INIT; - print_percent_done_silent = PRINT_PERCENT_DONE_INIT; + print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; + print_percent_done_normal = PRINT_PERCENT_DONE_INIT; + print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; + print_percent_done_silent = PRINT_PERCENT_DONE_INIT; + print_time_to_change = PRINT_TIME_REMAINING_INIT; } void load_filament_final_feed() diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f8b791b0..1854d846 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -673,22 +673,30 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time uint16_t print_t = 0; - if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) + int chars = 0; + char suff = ' '; + char suff_doubt = ' '; + + if(print_time_to_change != PRINT_TIME_REMAINING_INIT) + { + print_t = print_time_to_change_remaining(); + suff = 'C'; + if (feedmultiply != 100) + suff_doubt = '?'; + } + else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) + { print_t = print_time_remaining(); + suff = 'R'; + if (feedmultiply != 100) + suff_doubt = '?'; + } else if(starttime != 0) print_t = _millis() / 60000 - starttime / 60000; - int chars = 0; - if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (starttime != 0))) + + if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0))) { - char suff = ' '; - char suff_doubt = ' '; - if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) - { - suff = 'R'; - if (feedmultiply != 100) - suff_doubt = '?'; - } - if (print_t < 6000) //time<100h + if (print_t < 6000) //time<100h chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt); else //time>=100h chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt); From cca90da64bf40f671d401b5dd194a4352774b94e Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sun, 7 Feb 2021 09:48:48 +0100 Subject: [PATCH 02/15] Include silent mode on time change - depends on difference between print time remaining NORMAL vs SILENT mode --- Firmware/Marlin_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b36dd16a..333e3a30 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -11677,12 +11677,12 @@ uint16_t print_time_remaining() { uint16_t print_time_to_change_remaining() { uint16_t print_t = PRINT_TIME_REMAINING_INIT; -//#ifdef TMC2130 -// if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; -// else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); -//#else +/#ifdef TMC2130 + if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; + else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); +#else print_t = print_time_to_change; -//#endif //TMC2130 +#endif //TMC2130 if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; return print_t; } From f4ca6ee59d657ec7be06938f20294e12e0acd568 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sun, 7 Feb 2021 09:52:25 +0100 Subject: [PATCH 03/15] Fix typo --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 333e3a30..2a67e3ad 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -11677,7 +11677,7 @@ uint16_t print_time_remaining() { uint16_t print_time_to_change_remaining() { uint16_t print_t = PRINT_TIME_REMAINING_INIT; -/#ifdef TMC2130 +#ifdef TMC2130 if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); #else From ae48e7c3ce5f0a1db13b22ada3e2fc6e9d7ed0f3 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sun, 7 Feb 2021 10:37:41 +0100 Subject: [PATCH 04/15] indentation --- Firmware/Marlin_main.cpp | 101 +++++++++++++++++++++------------------ Firmware/ultralcd.cpp | 58 +++++++++++----------- 2 files changed, 83 insertions(+), 76 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2a67e3ad..c50ec029 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6392,40 +6392,41 @@ Sigma_Exit: #endif // Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING - /*! - ### M73 - Set/get print progress M73: Set/Get build percentage - #### Usage - - M73 [ P | R | Q | S | C ] - - #### Parameters + /*! + ### M73 - Set/get print progress M73: Set/Get build percentage + #### Usage + + M73 [ P | R | Q | S | C ] + + #### Parameters - `P` - Percent in normal mode - `R` - Time remaining in normal mode - `Q` - Percent in silent mode - `S` - Time in silent mode - `C` - Time to change/pause/user interaction - */ - case 73: //M73 show percent done and time remaining - if(code_seen('P')) print_percent_done_normal = code_value(); - if(code_seen('R')) print_time_remaining_normal = code_value(); - if(code_seen('Q')) print_percent_done_silent = code_value(); - if(code_seen('S')) print_time_remaining_silent = code_value(); + */ + //!@todo update RepRap Gcode wiki + case 73: //M73 show percent done and time remaining + { + if(code_seen('P')) print_percent_done_normal = code_value(); + if(code_seen('R')) print_time_remaining_normal = code_value(); + if(code_seen('Q')) print_percent_done_silent = code_value(); + if(code_seen('S')) print_time_remaining_silent = code_value(); - { - const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n"); - printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal); - printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent); - } + { + const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n"); + printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal); + printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent); + } print_time_to_change = PRINT_TIME_REMAINING_INIT; - if(code_seen('C')) + if(code_seen('C')) { print_time_to_change = code_value(); - printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change); - } - - break; - + printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change); + } + break; + } /*! ### M104 - Set hotend temperature M104: Set Extruder Temperature #### Usage @@ -11663,50 +11664,56 @@ void print_mesh_bed_leveling_table() SERIAL_ECHOLN(); } -uint16_t print_time_remaining() { - uint16_t print_t = PRINT_TIME_REMAINING_INIT; +uint16_t print_time_remaining() +{ + uint16_t print_t = PRINT_TIME_REMAINING_INIT; #ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal; - else print_t = print_time_remaining_silent; + if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal; + else print_t = print_time_remaining_silent; #else - print_t = print_time_remaining_normal; + print_t = print_time_remaining_normal; #endif //TMC2130 - if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; - return print_t; + if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; + return print_t; } -uint16_t print_time_to_change_remaining() { - uint16_t print_t = PRINT_TIME_REMAINING_INIT; +uint16_t print_time_to_change_remaining() +{ + uint16_t print_t = PRINT_TIME_REMAINING_INIT; #ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; + if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); #else print_t = print_time_to_change; #endif //TMC2130 - if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; - return print_t; + if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; + return print_t; } uint8_t calc_percent_done() { - //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize - uint8_t percent_done = 0; + //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize + uint8_t percent_done = 0; #ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) { - percent_done = print_percent_done_normal; - } - else if (print_percent_done_silent <= 100) { + if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) + { + percent_done = print_percent_done_normal; + } + else if (print_percent_done_silent <= 100) + { percent_done = print_percent_done_silent; } #else - if (print_percent_done_normal <= 100) { + if (print_percent_done_normal <= 100) + { percent_done = print_percent_done_normal; } #endif //TMC2130 - else { - percent_done = card.percentDone(); - } - return percent_done; + else + { + percent_done = card.percentDone(); + } + return percent_done; } static void print_time_remaining_init() diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1854d846..cf4737cb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -671,39 +671,39 @@ void lcdui_print_cmd_diag(void) // Print time (8 chars total) void lcdui_print_time(void) { - //if remaining print time estimation is available print it else print elapsed time - uint16_t print_t = 0; - int chars = 0; + //if remaining print time estimation is available print it else print elapsed time + uint16_t print_t = 0; + int chars = 0; char suff = ' '; char suff_doubt = ' '; - if(print_time_to_change != PRINT_TIME_REMAINING_INIT) - { - print_t = print_time_to_change_remaining(); - suff = 'C'; - if (feedmultiply != 100) - suff_doubt = '?'; - } - else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) - { - print_t = print_time_remaining(); - suff = 'R'; - if (feedmultiply != 100) - suff_doubt = '?'; - } - else if(starttime != 0) - print_t = _millis() / 60000 - starttime / 60000; + if(print_time_to_change != PRINT_TIME_REMAINING_INIT) + { + print_t = print_time_to_change_remaining(); + suff = 'C'; + if (feedmultiply != 100) + suff_doubt = '?'; + } + else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) + { + print_t = print_time_remaining(); + suff = 'R'; + if (feedmultiply != 100) + suff_doubt = '?'; + } + else if(starttime != 0) + print_t = _millis() / 60000 - starttime / 60000; - if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0))) - { - if (print_t < 6000) //time<100h - chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt); - else //time>=100h - chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt); - } - else - chars = lcd_printf_P(_N("%c--:-- "), LCD_STR_CLOCK[0]); - lcd_space(8 - chars); + if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0))) + { + if (print_t < 6000) //time<100h + chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt); + else //time>=100h + chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt); + } + else + chars = lcd_printf_P(_N("%c--:-- "), LCD_STR_CLOCK[0]); + lcd_space(8 - chars); } //Print status line on status screen From 91c767b0f24d9d3877a88e8588c8711375512bfa Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 8 Feb 2021 03:34:01 +0100 Subject: [PATCH 05/15] Reduce code size --- Firmware/Configuration.h | 2 +- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 28 +----------------------- Firmware/ultralcd.cpp | 47 +++++++++++++++++++++++----------------- 4 files changed, 29 insertions(+), 50 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 62688ebe..80d250bf 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -17,7 +17,7 @@ extern PGM_P sPrinterName; // Firmware version #define FW_VERSION "3.9.3" -#define FW_COMMIT_NR 3556 +#define FW_COMMIT_NR 5002 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 5ef7ca00..49201c3a 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -438,8 +438,6 @@ extern void cancel_saved_printing(); //estimated time to end of the print -extern uint16_t print_time_remaining(); -extern uint16_t print_time_to_change_remaining(); extern uint8_t calc_percent_done(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c50ec029..426a3217 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6423,7 +6423,7 @@ Sigma_Exit: if(code_seen('C')) { print_time_to_change = code_value(); - printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change); + printf_P(_N("Change in mins: %d\n"), print_time_to_change); } break; } @@ -11664,32 +11664,6 @@ void print_mesh_bed_leveling_table() SERIAL_ECHOLN(); } -uint16_t print_time_remaining() -{ - uint16_t print_t = PRINT_TIME_REMAINING_INIT; -#ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal; - else print_t = print_time_remaining_silent; -#else - print_t = print_time_remaining_normal; -#endif //TMC2130 - if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; - return print_t; -} - -uint16_t print_time_to_change_remaining() -{ - uint16_t print_t = PRINT_TIME_REMAINING_INIT; -#ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change; - else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent); -#else - print_t = print_time_to_change; -#endif //TMC2130 - if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply; - return print_t; -} - uint8_t calc_percent_done() { //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cf4737cb..43d80799 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -672,30 +672,37 @@ void lcdui_print_cmd_diag(void) void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time - uint16_t print_t = 0; int chars = 0; - char suff = ' '; - char suff_doubt = ' '; + if ((PRINTER_ACTIVE) && (starttime != 0)) + { + uint16_t print_t = 0; + char suff = ' '; + char suff_doubt = ' '; - if(print_time_to_change != PRINT_TIME_REMAINING_INIT) - { - print_t = print_time_to_change_remaining(); - suff = 'C'; + if (print_time_to_change != PRINT_TIME_REMAINING_INIT) + { + print_t = print_time_to_change; + suff = 'C'; + } + else + { + suff = 'R'; + #ifdef TMC2130 + if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT && (SilentModeMenu != SILENT_MODE_OFF)) + { + print_t = print_time_remaining_silent; + } + else + #endif //TMC2130 + print_t = print_time_remaining_normal; + } + if (feedmultiply != 100) + { suff_doubt = '?'; - } - else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) - { - print_t = print_time_remaining(); - suff = 'R'; - if (feedmultiply != 100) - suff_doubt = '?'; - } - else if(starttime != 0) - print_t = _millis() / 60000 - starttime / 60000; - - if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0))) - { + print_t = 100ul * print_t / feedmultiply; + } + if (print_t < 6000) //time<100h chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt); else //time>=100h From 83e791cbbe390730d56ad137b1b78064803cf43b Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 8 Feb 2021 04:05:01 +0100 Subject: [PATCH 06/15] Fix temp Build number --- Firmware/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 80d250bf..62688ebe 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -17,7 +17,7 @@ extern PGM_P sPrinterName; // Firmware version #define FW_VERSION "3.9.3" -#define FW_COMMIT_NR 5002 +#define FW_COMMIT_NR 3556 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From d063ffb1413960004060c8b52229edec4bf67675 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 08:13:40 +0100 Subject: [PATCH 07/15] Add parameter `D` to gcode `M73` for silent/stealth mode --- Firmware/Marlin.h | 3 ++- Firmware/Marlin_main.cpp | 16 +++++++++----- Firmware/ultralcd.cpp | 48 +++++++++++++++++++++++++++++----------- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 49201c3a..a1b6fe4e 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -366,7 +366,8 @@ extern uint8_t print_percent_done_normal; extern uint16_t print_time_remaining_normal; extern uint8_t print_percent_done_silent; extern uint16_t print_time_remaining_silent; -extern uint16_t print_time_to_change; +extern uint16_t print_time_to_change_normal; +extern uint16_t print_time_to_change_silent; #define PRINT_TIME_REMAINING_INIT 0xffff diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 426a3217..95acdf8f 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -316,7 +316,8 @@ uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT; uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT; uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes -uint16_t print_time_to_change = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes +uint16_t print_time_to_change_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes +uint16_t print_time_to_change_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes uint32_t IP_address = 0; @@ -6419,11 +6420,13 @@ Sigma_Exit: printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent); } - print_time_to_change = PRINT_TIME_REMAINING_INIT; - if(code_seen('C')) + if(code_seen('C')) print_time_to_change_normal = code_value(); + if(code_seen('D')) print_time_to_change_silent = code_value(); + { - print_time_to_change = code_value(); - printf_P(_N("Change in mins: %d\n"), print_time_to_change); + const char* _msg_mode_done_remain = _N("%S MODE: Change in mins: %d\n"); + printf_P(_msg_mode_done_remain, _N("NORMAL"), print_time_to_change_normal); + printf_P(_msg_mode_done_remain, _N("SILENT"), print_time_to_change_silent); } break; } @@ -11696,7 +11699,8 @@ static void print_time_remaining_init() print_percent_done_normal = PRINT_PERCENT_DONE_INIT; print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; print_percent_done_silent = PRINT_PERCENT_DONE_INIT; - print_time_to_change = PRINT_TIME_REMAINING_INIT; + print_time_to_change_normal = PRINT_TIME_REMAINING_INIT; + print_time_to_change_silent = PRINT_TIME_REMAINING_INIT; } void load_filament_final_feed() diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 43d80799..5041f203 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -676,33 +676,55 @@ void lcdui_print_time(void) if ((PRINTER_ACTIVE) && (starttime != 0)) { uint16_t print_t = 0; + uint16_t print_tr = 0; + uint16_t print_tc = 0; char suff = ' '; char suff_doubt = ' '; - if (print_time_to_change != PRINT_TIME_REMAINING_INIT) + #ifdef TMC2130 + if (SilentModeMenu != SILENT_MODE_OFF) { - print_t = print_time_to_change; + if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT) + { + print_tr = print_time_remaining_silent; + } + if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT) + { + print_tc = print_time_to_change_silent; + } + } + else + { + #endif //TMC2130 + if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) + { + print_tr = print_time_remaining_normal; + } + if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT) + { + print_tc = print_time_to_change_normal; + } + #ifdef TMC2130 + } + #endif //TMC2130 + + if (print_tc != 0) + { + print_t = print_tc; suff = 'C'; } - else + else if (print_tr != 0) { + print_t = print_tr; suff = 'R'; - #ifdef TMC2130 - if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT && (SilentModeMenu != SILENT_MODE_OFF)) - { - print_t = print_time_remaining_silent; } - else - #endif //TMC2130 - print_t = print_time_remaining_normal; - } - + if (feedmultiply != 100) { suff_doubt = '?'; print_t = 100ul * print_t / feedmultiply; } - + if (print_t < 6000) //time<100h chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt); else //time>=100h From 4998cfb70d4f8778f3f7f7c7fcb3d52a94f56d5d Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 08:59:31 +0100 Subject: [PATCH 08/15] Fix printing time being shown without `M73` gcode Adjust estimated times only if speed is changed. Printing time has to stay printing time. --- Firmware/ultralcd.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5041f203..cd5705aa 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -718,8 +718,12 @@ void lcdui_print_time(void) print_t = print_tr; suff = 'R'; } + else + { + print_t = _millis() / 60000 - starttime / 60000; + } - if (feedmultiply != 100) + if (feedmultiply != 100 && (print_tc != 0 || print_tr !=0)) { suff_doubt = '?'; print_t = 100ul * print_t / feedmultiply; From b13d4b71d437962cf2b493d0f1805cfe44b8d613 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 09:29:47 +0100 Subject: [PATCH 09/15] Add Change time behind existing message --- Firmware/Marlin_main.cpp | 62 ++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 95acdf8f..2b89958c 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6393,43 +6393,37 @@ Sigma_Exit: #endif // Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING - /*! - ### M73 - Set/get print progress M73: Set/Get build percentage - #### Usage - - M73 [ P | R | Q | S | C ] - - #### Parameters - - `P` - Percent in normal mode - - `R` - Time remaining in normal mode - - `Q` - Percent in silent mode - - `S` - Time in silent mode - - `C` - Time to change/pause/user interaction - */ - //!@todo update RepRap Gcode wiki - case 73: //M73 show percent done and time remaining - { - if(code_seen('P')) print_percent_done_normal = code_value(); - if(code_seen('R')) print_time_remaining_normal = code_value(); - if(code_seen('Q')) print_percent_done_silent = code_value(); - if(code_seen('S')) print_time_remaining_silent = code_value(); - - { - const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n"); - printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal); - printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent); - } - - if(code_seen('C')) print_time_to_change_normal = code_value(); - if(code_seen('D')) print_time_to_change_silent = code_value(); + /*! + ### M73 - Set/get print progress M73: Set/Get build percentage + #### Usage + M73 [ P | R | Q | S | C | D ] + + #### Parameters + - `P` - Percent in normal mode + - `R` - Time remaining in normal mode + - `Q` - Percent in silent mode + - `S` - Time in silent mode + - `C` - Time to change/pause/user interaction in normal mode + - `D` - Time to change/pause/user interaction in silent mode + */ + //!@todo update RepRap Gcode wiki + case 73: //M73 show percent done, time remaining and time to change/pause { - const char* _msg_mode_done_remain = _N("%S MODE: Change in mins: %d\n"); - printf_P(_msg_mode_done_remain, _N("NORMAL"), print_time_to_change_normal); - printf_P(_msg_mode_done_remain, _N("SILENT"), print_time_to_change_silent); + if(code_seen('P')) print_percent_done_normal = code_value(); + if(code_seen('R')) print_time_remaining_normal = code_value(); + if(code_seen('Q')) print_percent_done_silent = code_value(); + if(code_seen('S')) print_time_remaining_silent = code_value(); + if(code_seen('C')) print_time_to_change_normal = code_value(); + if(code_seen('D')) print_time_to_change_silent = code_value(); + + { + const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d; Change in mins: %d\n"); + printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal, print_time_to_change_normal); + printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent, print_time_to_change_silent); + } + break; } - break; - } /*! ### M104 - Set hotend temperature M104: Set Extruder Temperature #### Usage From b9a3fa2ddd7f955ccfd0551b9980cd0d5052a4b2 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 09:31:33 +0100 Subject: [PATCH 10/15] fix time at speed --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cd5705aa..057d7dea 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -723,7 +723,7 @@ void lcdui_print_time(void) print_t = _millis() / 60000 - starttime / 60000; } - if (feedmultiply != 100 && (print_tc != 0 || print_tr !=0)) + if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) { suff_doubt = '?'; print_t = 100ul * print_t / feedmultiply; From 14b4bf5fa5dd8906ea89895470b1ad1f56f1248f Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 16:18:47 +0100 Subject: [PATCH 11/15] Add CLOCK_INTERVAL_TIME and ShortTimer IntervalTimer --- Firmware/Configuration_adv.h | 6 ++++++ Firmware/ultralcd.cpp | 16 +++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 7a9a4929..8895eef6 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -338,6 +338,12 @@ const unsigned int dropsegments=5; //everything with less than this number of st // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL +//LCD status clock interval timer to switch between +// print time +// remaining print time +// and time to change/pause/interaction +#define CLOCK_INTERVAL_TIME 5000 + //=========================================================================== //=============================Buffers ============================ //=========================================================================== diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 057d7dea..98f4dccd 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -673,6 +673,7 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time int chars = 0; + ShortTimer IntervalTimer; if ((PRINTER_ACTIVE) && (starttime != 0)) { uint16_t print_t = 0; @@ -708,17 +709,18 @@ void lcdui_print_time(void) } #endif //TMC2130 - if (print_tc != 0) - { - print_t = print_tc; - suff = 'C'; - } - else if (print_tr != 0) + if (print_tr != 0) { print_t = print_tr; suff = 'R'; } - else + else if (print_tc != 0) + { + print_t = print_tc; + suff = 'C'; + } + + if (print_tr == 0) { print_t = _millis() / 60000 - starttime / 60000; } From cf982b0d4dee71cae62d0a673b8efc2f2c64ced5 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 11 Feb 2021 10:20:06 +0100 Subject: [PATCH 12/15] Fix timer issue The remaining time stays for ~5 seconds while the change time stays just for ~1 second --- Firmware/ultralcd.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 98f4dccd..1653e61a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -673,7 +673,6 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time int chars = 0; - ShortTimer IntervalTimer; if ((PRINTER_ACTIVE) && (starttime != 0)) { uint16_t print_t = 0; @@ -681,6 +680,8 @@ void lcdui_print_time(void) uint16_t print_tc = 0; char suff = ' '; char suff_doubt = ' '; + static ShortTimer IntervalTimer; + #ifdef TMC2130 if (SilentModeMenu != SILENT_MODE_OFF) @@ -714,10 +715,15 @@ void lcdui_print_time(void) print_t = print_tr; suff = 'R'; } - else if (print_tc != 0) + + if (print_tc != 0) { - print_t = print_tc; - suff = 'C'; + if (IntervalTimer.expired(5000)) + { + print_t = print_tc; + suff = 'C'; + IntervalTimer.start(); + } } if (print_tr == 0) From d2e60aee90fca67c01338ef4a49ad656a6164719 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 11 Feb 2021 10:45:26 +0100 Subject: [PATCH 13/15] Use `CLOCK_INTERVAL_TIME` --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1653e61a..8a8f6b79 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -718,7 +718,7 @@ void lcdui_print_time(void) if (print_tc != 0) { - if (IntervalTimer.expired(5000)) + if (IntervalTimer.expired(CLOCK_INTERVAL_TIME)) { print_t = print_tc; suff = 'C'; From f810047a5c9cd4d9cbeea5947cc84183986f01fd Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Fri, 12 Feb 2021 11:29:47 +0100 Subject: [PATCH 14/15] Switch between Remaing and Change time every few seconds - If `M73` `R,S,C,D` values set the LCD Info screen clock switchs between Remaining and Change time - If Remaining time is 0 while Change time is >0 the clock switchs between Change time and actual printing time - If Change is 0 while Remaining time is >0 the clock shows the Remaining time - If both are 0 the clock shows the actual printing time - `M73 C` values are shown in "Normal" mode - `M73 D` values are shown in "Stealth" mode - Changing the speed will try to calculate the espected times and show `?` behind `R` or `C` --- Firmware/Configuration_adv.h | 3 +-- Firmware/ultralcd.cpp | 43 ++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 8895eef6..ee12716e 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -339,10 +339,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st //#define HEATERS_PARALLEL //LCD status clock interval timer to switch between -// print time // remaining print time // and time to change/pause/interaction -#define CLOCK_INTERVAL_TIME 5000 +#define CLOCK_INTERVAL_TIME 5 //=========================================================================== //=============================Buffers ============================ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8a8f6b79..422566f1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -57,7 +57,7 @@ int scrollstuff = 0; char longFilenameOLD[LONG_FILENAME_LENGTH]; - +int clock_interval = 0; static void lcd_sd_updir(); static void lcd_mesh_bed_leveling_settings(); @@ -680,53 +680,58 @@ void lcdui_print_time(void) uint16_t print_tc = 0; char suff = ' '; char suff_doubt = ' '; - static ShortTimer IntervalTimer; - - #ifdef TMC2130 +#ifdef TMC2130 if (SilentModeMenu != SILENT_MODE_OFF) { if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT) { print_tr = print_time_remaining_silent; } +//#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT) { print_tc = print_time_to_change_silent; } +//#endif //CLOCK_INTERVAL_TIME } else { - #endif //TMC2130 +#endif //TMC2130 if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) { print_tr = print_time_remaining_normal; } +//#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT) { print_tc = print_time_to_change_normal; } - #ifdef TMC2130 +//#endif //CLOCK_INTERVAL_TIME +#ifdef TMC2130 } - #endif //TMC2130 +#endif //TMC2130 +//#ifdef CLOCK_INTERVAL_TIME + if (clock_interval == CLOCK_INTERVAL_TIME*2) + { + clock_interval = 0; + } + clock_interval++; + + if (print_tc != 0 && clock_interval > CLOCK_INTERVAL_TIME) + { + print_t = print_tc; + suff = 'C'; + } + else +//#endif //CLOCK_INTERVAL_TIME if (print_tr != 0) { print_t = print_tr; suff = 'R'; } - - if (print_tc != 0) - { - if (IntervalTimer.expired(CLOCK_INTERVAL_TIME)) - { - print_t = print_tc; - suff = 'C'; - IntervalTimer.start(); - } - } - - if (print_tr == 0) + else { print_t = _millis() / 60000 - starttime / 60000; } From c95a8e13d76ddefe6b1c4a1bf32dcfec051e9987 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Fri, 12 Feb 2021 11:47:02 +0100 Subject: [PATCH 15/15] Fix indentations to 4 spaces per tab --- Firmware/Marlin_main.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2b89958c..c23a1c15 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -11663,28 +11663,28 @@ void print_mesh_bed_leveling_table() uint8_t calc_percent_done() { - //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize - uint8_t percent_done = 0; + //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize + uint8_t percent_done = 0; #ifdef TMC2130 - if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) - { - percent_done = print_percent_done_normal; - } - else if (print_percent_done_silent <= 100) - { - percent_done = print_percent_done_silent; - } + if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) + { + percent_done = print_percent_done_normal; + } + else if (print_percent_done_silent <= 100) + { + percent_done = print_percent_done_silent; + } #else - if (print_percent_done_normal <= 100) - { - percent_done = print_percent_done_normal; - } + if (print_percent_done_normal <= 100) + { + percent_done = print_percent_done_normal; + } #endif //TMC2130 - else - { - percent_done = card.percentDone(); - } - return percent_done; + else + { + percent_done = card.percentDone(); + } + return percent_done; } static void print_time_remaining_init()