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