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`
This commit is contained in:
3d-gussner 2021-02-12 11:29:47 +01:00
parent d2e60aee90
commit f810047a5c
2 changed files with 25 additions and 21 deletions

View File

@ -339,10 +339,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
//#define HEATERS_PARALLEL //#define HEATERS_PARALLEL
//LCD status clock interval timer to switch between //LCD status clock interval timer to switch between
// print time
// remaining print time // remaining print time
// and time to change/pause/interaction // and time to change/pause/interaction
#define CLOCK_INTERVAL_TIME 5000 #define CLOCK_INTERVAL_TIME 5
//=========================================================================== //===========================================================================
//=============================Buffers ============================ //=============================Buffers ============================

View File

@ -57,7 +57,7 @@
int scrollstuff = 0; int scrollstuff = 0;
char longFilenameOLD[LONG_FILENAME_LENGTH]; char longFilenameOLD[LONG_FILENAME_LENGTH];
int clock_interval = 0;
static void lcd_sd_updir(); static void lcd_sd_updir();
static void lcd_mesh_bed_leveling_settings(); static void lcd_mesh_bed_leveling_settings();
@ -680,53 +680,58 @@ void lcdui_print_time(void)
uint16_t print_tc = 0; uint16_t print_tc = 0;
char suff = ' '; char suff = ' ';
char suff_doubt = ' '; char suff_doubt = ' ';
static ShortTimer IntervalTimer;
#ifdef TMC2130
#ifdef TMC2130
if (SilentModeMenu != SILENT_MODE_OFF) if (SilentModeMenu != SILENT_MODE_OFF)
{ {
if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT) if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT)
{ {
print_tr = print_time_remaining_silent; print_tr = print_time_remaining_silent;
} }
//#ifdef CLOCK_INTERVAL_TIME
if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT) if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT)
{ {
print_tc = print_time_to_change_silent; print_tc = print_time_to_change_silent;
} }
//#endif //CLOCK_INTERVAL_TIME
} }
else else
{ {
#endif //TMC2130 #endif //TMC2130
if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
{ {
print_tr = print_time_remaining_normal; print_tr = print_time_remaining_normal;
} }
//#ifdef CLOCK_INTERVAL_TIME
if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT) if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT)
{ {
print_tc = print_time_to_change_normal; 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) if (print_tr != 0)
{ {
print_t = print_tr; print_t = print_tr;
suff = 'R'; suff = 'R';
} }
else
if (print_tc != 0)
{
if (IntervalTimer.expired(CLOCK_INTERVAL_TIME))
{
print_t = print_tc;
suff = 'C';
IntervalTimer.start();
}
}
if (print_tr == 0)
{ {
print_t = _millis() / 60000 - starttime / 60000; print_t = _millis() / 60000 - starttime / 60000;
} }