Merge pull request #3021 from 3d-gussner/PFW-910
PFW-910 Add remaining time to change/pause/user interaction to LCD Info screen
This commit is contained in:
commit
2874e704f5
|
|
@ -338,6 +338,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st
|
||||||
// Control heater 0 and heater 1 in parallel.
|
// Control heater 0 and heater 1 in parallel.
|
||||||
//#define HEATERS_PARALLEL
|
//#define HEATERS_PARALLEL
|
||||||
|
|
||||||
|
//LCD status clock interval timer to switch between
|
||||||
|
// remaining print time
|
||||||
|
// and time to change/pause/interaction
|
||||||
|
#define CLOCK_INTERVAL_TIME 5
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================Buffers ============================
|
//=============================Buffers ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
||||||
|
|
@ -366,6 +366,8 @@ extern uint8_t print_percent_done_normal;
|
||||||
extern uint16_t print_time_remaining_normal;
|
extern uint16_t print_time_remaining_normal;
|
||||||
extern uint8_t print_percent_done_silent;
|
extern uint8_t print_percent_done_silent;
|
||||||
extern uint16_t print_time_remaining_silent;
|
extern uint16_t print_time_remaining_silent;
|
||||||
|
extern uint16_t print_time_to_change_normal;
|
||||||
|
extern uint16_t print_time_to_change_silent;
|
||||||
|
|
||||||
#define PRINT_TIME_REMAINING_INIT 0xffff
|
#define PRINT_TIME_REMAINING_INIT 0xffff
|
||||||
|
|
||||||
|
|
@ -437,7 +439,6 @@ extern void cancel_saved_printing();
|
||||||
|
|
||||||
|
|
||||||
//estimated time to end of the print
|
//estimated time to end of the print
|
||||||
extern uint16_t print_time_remaining();
|
|
||||||
extern uint8_t calc_percent_done();
|
extern uint8_t calc_percent_done();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,6 +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
|
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;
|
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_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time 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;
|
uint32_t IP_address = 0;
|
||||||
|
|
||||||
|
|
@ -6391,31 +6393,37 @@ Sigma_Exit:
|
||||||
#endif // Z_PROBE_REPEATABILITY_TEST
|
#endif // Z_PROBE_REPEATABILITY_TEST
|
||||||
#endif // ENABLE_AUTO_BED_LEVELING
|
#endif // ENABLE_AUTO_BED_LEVELING
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
### M73 - Set/get print progress <a href="https://reprap.org/wiki/G-code#M73:_Set.2FGet_build_percentage">M73: Set/Get build percentage</a>
|
### M73 - Set/get print progress <a href="https://reprap.org/wiki/G-code#M73:_Set.2FGet_build_percentage">M73: Set/Get build percentage</a>
|
||||||
#### Usage
|
#### Usage
|
||||||
|
|
||||||
M73 [ P | R | Q | S ]
|
M73 [ P | R | Q | S | C | D ]
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
- `P` - Percent in normal mode
|
- `P` - Percent in normal mode
|
||||||
- `R` - Time remaining in normal mode
|
- `R` - Time remaining in normal mode
|
||||||
- `Q` - Percent in silent mode
|
- `Q` - Percent in silent mode
|
||||||
- `S` - Time in silent mode
|
- `S` - Time in silent mode
|
||||||
*/
|
- `C` - Time to change/pause/user interaction in normal mode
|
||||||
case 73: //M73 show percent done and time remaining
|
- `D` - Time to change/pause/user interaction in silent mode
|
||||||
if(code_seen('P')) print_percent_done_normal = code_value();
|
*/
|
||||||
if(code_seen('R')) print_time_remaining_normal = code_value();
|
//!@todo update RepRap Gcode wiki
|
||||||
if(code_seen('Q')) print_percent_done_silent = code_value();
|
case 73: //M73 show percent done, time remaining and time to change/pause
|
||||||
if(code_seen('S')) print_time_remaining_silent = code_value();
|
{
|
||||||
|
if(code_seen('P')) print_percent_done_normal = code_value();
|
||||||
{
|
if(code_seen('R')) print_time_remaining_normal = code_value();
|
||||||
const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n");
|
if(code_seen('Q')) print_percent_done_silent = code_value();
|
||||||
printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal);
|
if(code_seen('S')) print_time_remaining_silent = code_value();
|
||||||
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();
|
||||||
break;
|
|
||||||
|
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
### M104 - Set hotend temperature <a href="https://reprap.org/wiki/G-code#M104:_Set_Extruder_Temperature">M104: Set Extruder Temperature</a>
|
### M104 - Set hotend temperature <a href="https://reprap.org/wiki/G-code#M104:_Set_Extruder_Temperature">M104: Set Extruder Temperature</a>
|
||||||
#### Usage
|
#### Usage
|
||||||
|
|
@ -11653,46 +11661,40 @@ void print_mesh_bed_leveling_table()
|
||||||
SERIAL_ECHOLN();
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t calc_percent_done()
|
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
|
//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;
|
uint8_t percent_done = 0;
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) {
|
if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100)
|
||||||
percent_done = print_percent_done_normal;
|
{
|
||||||
}
|
percent_done = print_percent_done_normal;
|
||||||
else if (print_percent_done_silent <= 100) {
|
}
|
||||||
percent_done = print_percent_done_silent;
|
else if (print_percent_done_silent <= 100)
|
||||||
}
|
{
|
||||||
|
percent_done = print_percent_done_silent;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (print_percent_done_normal <= 100) {
|
if (print_percent_done_normal <= 100)
|
||||||
percent_done = print_percent_done_normal;
|
{
|
||||||
}
|
percent_done = print_percent_done_normal;
|
||||||
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
else {
|
else
|
||||||
percent_done = card.percentDone();
|
{
|
||||||
}
|
percent_done = card.percentDone();
|
||||||
return percent_done;
|
}
|
||||||
|
return percent_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_time_remaining_init()
|
static void print_time_remaining_init()
|
||||||
{
|
{
|
||||||
print_time_remaining_normal = 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_normal = PRINT_PERCENT_DONE_INIT;
|
print_time_remaining_silent = PRINT_TIME_REMAINING_INIT;
|
||||||
print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
||||||
|
print_time_to_change_normal = PRINT_TIME_REMAINING_INIT;
|
||||||
|
print_time_to_change_silent = PRINT_TIME_REMAINING_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_filament_final_feed()
|
void load_filament_final_feed()
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
@ -671,31 +671,85 @@ void lcdui_print_cmd_diag(void)
|
||||||
// Print time (8 chars total)
|
// Print time (8 chars total)
|
||||||
void lcdui_print_time(void)
|
void lcdui_print_time(void)
|
||||||
{
|
{
|
||||||
//if remaining print time estimation is available print it else print elapsed time
|
//if remaining print time estimation is available print it else print elapsed time
|
||||||
uint16_t print_t = 0;
|
int chars = 0;
|
||||||
if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
|
if ((PRINTER_ACTIVE) && (starttime != 0))
|
||||||
print_t = print_time_remaining();
|
{
|
||||||
else if(starttime != 0)
|
uint16_t print_t = 0;
|
||||||
print_t = _millis() / 60000 - starttime / 60000;
|
uint16_t print_tr = 0;
|
||||||
int chars = 0;
|
uint16_t print_tc = 0;
|
||||||
if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
|
char suff = ' ';
|
||||||
{
|
char suff_doubt = ' ';
|
||||||
char suff = ' ';
|
|
||||||
char suff_doubt = ' ';
|
#ifdef TMC2130
|
||||||
if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
|
if (SilentModeMenu != SILENT_MODE_OFF)
|
||||||
{
|
{
|
||||||
suff = 'R';
|
if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT)
|
||||||
if (feedmultiply != 100)
|
{
|
||||||
suff_doubt = '?';
|
print_tr = print_time_remaining_silent;
|
||||||
}
|
}
|
||||||
if (print_t < 6000) //time<100h
|
//#ifdef CLOCK_INTERVAL_TIME
|
||||||
chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt);
|
if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT)
|
||||||
else //time>=100h
|
{
|
||||||
chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt);
|
print_tc = print_time_to_change_silent;
|
||||||
}
|
}
|
||||||
else
|
//#endif //CLOCK_INTERVAL_TIME
|
||||||
chars = lcd_printf_P(_N("%c--:-- "), LCD_STR_CLOCK[0]);
|
}
|
||||||
lcd_space(8 - chars);
|
else
|
||||||
|
{
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
//#endif //CLOCK_INTERVAL_TIME
|
||||||
|
#ifdef 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';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print_t = _millis() / 60000 - starttime / 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc))
|
||||||
|
{
|
||||||
|
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
|
||||||
|
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
|
//Print status line on status screen
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue