Merge pull request #1691 from PavelSindler/MK2_time_remaining
show estimated time
This commit is contained in:
commit
88e6e1d4ad
|
|
@ -16,3 +16,14 @@
|
||||||
/Firmware/Firmware.vcxproj
|
/Firmware/Firmware.vcxproj
|
||||||
/Firmware/Firmware.sln
|
/Firmware/Firmware.sln
|
||||||
/Firmware/Firmware - Shortcut.lnk
|
/Firmware/Firmware - Shortcut.lnk
|
||||||
|
.settings
|
||||||
|
.project
|
||||||
|
.cproject
|
||||||
|
Debug
|
||||||
|
Firmware/Configuration_prusa.h
|
||||||
|
Firmware/Doc
|
||||||
|
/Firmware/.vs/Firmware/v14/.suo
|
||||||
|
/Firmware/Firmware.sln
|
||||||
|
/Firmware/Firmware.vcxproj
|
||||||
|
/Firmware/Firmware.vcxproj.filters
|
||||||
|
/Firmware/__vm
|
||||||
|
|
|
||||||
|
|
@ -340,6 +340,19 @@ extern bool sortAlpha;
|
||||||
|
|
||||||
extern void calculate_volumetric_multipliers();
|
extern void calculate_volumetric_multipliers();
|
||||||
|
|
||||||
|
|
||||||
|
//estimated time to end of the print
|
||||||
|
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;
|
||||||
|
|
||||||
|
#define PRINT_TIME_REMAINING_INIT 0xffff
|
||||||
|
#define PRINT_PERCENT_DONE_INIT 0xff
|
||||||
|
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == 4) || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused)
|
||||||
|
|
||||||
|
extern void calculate_extruder_multipliers();
|
||||||
|
|
||||||
// Similar to the default Arduino delay function,
|
// Similar to the default Arduino delay function,
|
||||||
// but it keeps the background tasks running.
|
// but it keeps the background tasks running.
|
||||||
extern void delay_keep_alive(unsigned int ms);
|
extern void delay_keep_alive(unsigned int ms);
|
||||||
|
|
@ -364,6 +377,10 @@ void serialecho_temperatures();
|
||||||
void proc_commands();
|
void proc_commands();
|
||||||
bool check_commands();
|
bool check_commands();
|
||||||
|
|
||||||
|
//estimated time to end of the print
|
||||||
|
extern uint16_t print_time_remaining();
|
||||||
|
extern uint8_t print_percent_done();
|
||||||
|
|
||||||
#ifdef HOST_KEEPALIVE_FEATURE
|
#ifdef HOST_KEEPALIVE_FEATURE
|
||||||
|
|
||||||
// States for managing Marlin and host communication
|
// States for managing Marlin and host communication
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@
|
||||||
// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
||||||
// The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
// The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
||||||
// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
||||||
|
// M73 - Show percent done and print time remaining
|
||||||
// M80 - Turn on Power Supply
|
// M80 - Turn on Power Supply
|
||||||
// M81 - Turn off Power Supply
|
// M81 - Turn off Power Supply
|
||||||
// M82 - Set E codes absolute (default)
|
// M82 - Set E codes absolute (default)
|
||||||
|
|
@ -401,6 +402,13 @@ bool no_response = false;
|
||||||
uint8_t important_status;
|
uint8_t important_status;
|
||||||
uint8_t saved_filament_type;
|
uint8_t saved_filament_type;
|
||||||
|
|
||||||
|
|
||||||
|
// storing estimated time to end of print counted by slicer
|
||||||
|
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
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================Private Variables=============================
|
//=============================Private Variables=============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
@ -501,6 +509,8 @@ static int saved_feedmultiply_mm = 100;
|
||||||
//=============================Routines======================================
|
//=============================Routines======================================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
static void print_time_remaining_init();
|
||||||
|
|
||||||
void get_arc_coordinates();
|
void get_arc_coordinates();
|
||||||
bool setTargetedHotend(int code);
|
bool setTargetedHotend(int code);
|
||||||
|
|
||||||
|
|
@ -4305,6 +4315,22 @@ Sigma_Exit:
|
||||||
}
|
}
|
||||||
#endif // Z_PROBE_REPEATABILITY_TEST
|
#endif // Z_PROBE_REPEATABILITY_TEST
|
||||||
#endif // ENABLE_AUTO_BED_LEVELING
|
#endif // ENABLE_AUTO_BED_LEVELING
|
||||||
|
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();
|
||||||
|
|
||||||
|
SERIAL_ECHOPGM("NORMAL MODE: Percent done: ");
|
||||||
|
MYSERIAL.print(int(print_percent_done_normal));
|
||||||
|
SERIAL_ECHOPGM("; print time remaining in mins: ");
|
||||||
|
MYSERIAL.println(print_time_remaining_normal);
|
||||||
|
SERIAL_ECHOPGM("SILENT MODE: Percent done: ");
|
||||||
|
MYSERIAL.print(int(print_percent_done_silent));
|
||||||
|
SERIAL_ECHOPGM("; print time remaining in mins: ");
|
||||||
|
MYSERIAL.println(print_time_remaining_silent);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 104: // M104
|
case 104: // M104
|
||||||
if(setTargetedHotend(104)){
|
if(setTargetedHotend(104)){
|
||||||
|
|
@ -4602,6 +4628,8 @@ Sigma_Exit:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//in the end of print set estimated time to end of print and extruders used during print to default values for next print
|
||||||
|
print_time_remaining_init();
|
||||||
snmm_filaments_used = 0;
|
snmm_filaments_used = 0;
|
||||||
break;
|
break;
|
||||||
case 85: // M85
|
case 85: // M85
|
||||||
|
|
@ -6998,3 +7026,29 @@ void serialecho_temperatures() {
|
||||||
SERIAL_PROTOCOL_F(degBed(), 1);
|
SERIAL_PROTOCOL_F(degBed(), 1);
|
||||||
SERIAL_PROTOCOLLN("");
|
SERIAL_PROTOCOLLN("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t print_time_remaining() {
|
||||||
|
uint16_t print_t = PRINT_TIME_REMAINING_INIT;
|
||||||
|
print_t = print_time_remaining_normal;
|
||||||
|
if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
|
||||||
|
return print_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t print_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;
|
||||||
|
if (print_percent_done_normal <= 100) {
|
||||||
|
percent_done = print_percent_done_normal;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
percent_done = card.percentDone();
|
||||||
|
}
|
||||||
|
return 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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ CardReader::CardReader()
|
||||||
sdpos = 0;
|
sdpos = 0;
|
||||||
sdprinting = false;
|
sdprinting = false;
|
||||||
cardOK = false;
|
cardOK = false;
|
||||||
|
paused = false;
|
||||||
saving = false;
|
saving = false;
|
||||||
logging = false;
|
logging = false;
|
||||||
autostart_atmillis=0;
|
autostart_atmillis=0;
|
||||||
|
|
@ -243,9 +244,10 @@ void CardReader::startFileprint()
|
||||||
if(cardOK)
|
if(cardOK)
|
||||||
{
|
{
|
||||||
sdprinting = true;
|
sdprinting = true;
|
||||||
#ifdef SDCARD_SORT_ALPHA
|
paused = false;
|
||||||
// flush_presort();
|
#ifdef SDCARD_SORT_ALPHA
|
||||||
#endif
|
//flush_presort();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,6 +256,7 @@ void CardReader::pauseSDPrint()
|
||||||
if(sdprinting)
|
if(sdprinting)
|
||||||
{
|
{
|
||||||
sdprinting = false;
|
sdprinting = false;
|
||||||
|
paused = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,6 +330,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
|
||||||
SERIAL_ECHOLN(name);
|
SERIAL_ECHOLN(name);
|
||||||
}
|
}
|
||||||
sdprinting = false;
|
sdprinting = false;
|
||||||
|
paused = false;
|
||||||
|
|
||||||
|
|
||||||
SdFile myDir;
|
SdFile myDir;
|
||||||
|
|
@ -513,8 +517,11 @@ void CardReader::getStatus()
|
||||||
SERIAL_PROTOCOL(itostr2(time%60));
|
SERIAL_PROTOCOL(itostr2(time%60));
|
||||||
SERIAL_PROTOCOLPGM("\n");
|
SERIAL_PROTOCOLPGM("\n");
|
||||||
}
|
}
|
||||||
|
else if (paused) {
|
||||||
|
SERIAL_PROTOCOLLNPGM("SD print paused");
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
SERIAL_PROTOCOLLNRPGM("Not printing");
|
SERIAL_PROTOCOLLNPGM("Not SD printing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CardReader::write_command(char *buf)
|
void CardReader::write_command(char *buf)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ public:
|
||||||
bool logging;
|
bool logging;
|
||||||
bool sdprinting ;
|
bool sdprinting ;
|
||||||
bool cardOK ;
|
bool cardOK ;
|
||||||
|
bool paused ;
|
||||||
char filename[13];
|
char filename[13];
|
||||||
uint16_t creationTime, creationDate;
|
uint16_t creationTime, creationDate;
|
||||||
uint32_t cluster, position;
|
uint32_t cluster, position;
|
||||||
|
|
|
||||||
|
|
@ -679,6 +679,53 @@ void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str)
|
||||||
lcd.print(str);
|
lcd.print(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void lcd_print_percent_done() {
|
||||||
|
if (is_usb_printing)
|
||||||
|
{
|
||||||
|
lcd_printPGM(PSTR("USB"));
|
||||||
|
}
|
||||||
|
else if(IS_SD_PRINTING)
|
||||||
|
{
|
||||||
|
lcd_printPGM(PSTR("SD"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_printPGM(PSTR(" "));
|
||||||
|
}
|
||||||
|
if (IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT)))
|
||||||
|
{
|
||||||
|
lcd.print(itostr3(print_percent_done()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_printPGM(PSTR("---"));
|
||||||
|
}
|
||||||
|
lcd.print('%');
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void lcd_print_time() {
|
||||||
|
//if remaining print time estimation is available print it else print elapsed time
|
||||||
|
//uses 8 characters
|
||||||
|
uint16_t print_t = 0;
|
||||||
|
if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT){
|
||||||
|
print_t = print_time_remaining();
|
||||||
|
}
|
||||||
|
else if(starttime != 0){
|
||||||
|
print_t = millis() / 60000 - starttime / 60000;
|
||||||
|
}
|
||||||
|
lcd.print(LCD_STR_CLOCK[0]);
|
||||||
|
if((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)||(starttime != 0)))
|
||||||
|
{
|
||||||
|
lcd.print(itostr2(print_t/60));
|
||||||
|
lcd.print(':');
|
||||||
|
lcd.print(itostr2(print_t%60));
|
||||||
|
(print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) ? lcd.print('R') : lcd.print(' ');
|
||||||
|
(feedmultiply == 100) ? lcd.print(' ') : lcd.print('?');
|
||||||
|
}else{
|
||||||
|
lcd_printPGM(PSTR("--:-- "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
20x4 |01234567890123456789|
|
20x4 |01234567890123456789|
|
||||||
|
|
@ -758,35 +805,14 @@ static void lcd_implementation_status_screen()
|
||||||
|
|
||||||
//Print SD status
|
//Print SD status
|
||||||
lcd.setCursor(0, 2);
|
lcd.setCursor(0, 2);
|
||||||
if (is_usb_printing)
|
lcd_print_percent_done();
|
||||||
{
|
|
||||||
lcd_printPGM(PSTR("--"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lcd_printPGM(PSTR("SD"));
|
|
||||||
}
|
|
||||||
if (IS_SD_PRINTING)
|
|
||||||
{
|
|
||||||
lcd.print(itostr3(card.percentDone()));
|
|
||||||
lcd.print('%');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (is_usb_printing)
|
|
||||||
{
|
|
||||||
lcd_printPGM(PSTR(">USB"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lcd_printPGM(PSTR("---"));
|
|
||||||
lcd.print('%');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Farm number display
|
// Farm number display
|
||||||
if (farm_mode)
|
if (farm_mode)
|
||||||
{
|
{
|
||||||
|
lcd.setCursor(0, 6);
|
||||||
lcd_printPGM(PSTR(" F"));
|
lcd_printPGM(PSTR(" F"));
|
||||||
lcd.print(farm_no);
|
lcd.print(farm_no);
|
||||||
lcd_printPGM(PSTR(" "));
|
lcd_printPGM(PSTR(" "));
|
||||||
|
|
@ -813,23 +839,16 @@ static void lcd_implementation_status_screen()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CMD_DIAGNOSTICS
|
||||||
|
lcd.setCursor(LCD_WIDTH - 8 -1, 2);
|
||||||
//Print time elapsed
|
lcd_printPGM(PSTR(" C"));
|
||||||
lcd.setCursor(LCD_WIDTH - 8 -1, 2);
|
lcd.print(buflen); // number of commands in cmd buffer
|
||||||
lcd_printPGM(PSTR(" "));
|
if (buflen < 9) lcd_printPGM(" ");
|
||||||
lcd.print(LCD_STR_CLOCK[0]);
|
#else
|
||||||
if(starttime != 0)
|
//Print time
|
||||||
{
|
lcd.setCursor(LCD_WIDTH - 8, 2);
|
||||||
uint16_t time = millis() / 60000 - starttime / 60000;
|
lcd_print_time();
|
||||||
lcd.print(itostr2(time/60));
|
#endif //CMD_DIAGNOSTICS
|
||||||
lcd.print(':');
|
|
||||||
lcd.print(itostr2(time%60));
|
|
||||||
}else{
|
|
||||||
lcd_printPGM(PSTR("--:--"));
|
|
||||||
}
|
|
||||||
lcd_printPGM(PSTR(" "));
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DISABLE_LCD_STATUS_LINE
|
#ifdef DEBUG_DISABLE_LCD_STATUS_LINE
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,6 @@ THERMISTORS SETTINGS
|
||||||
|
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,6 @@ THERMISTORS SETTINGS
|
||||||
|
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#ifndef SNMM
|
#ifndef SNMM
|
||||||
#define SUPPORT_VERBOSITY
|
#define SUPPORT_VERBOSITY
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#ifndef SNMM
|
#ifndef SNMM
|
||||||
#define SUPPORT_VERBOSITY
|
#define SUPPORT_VERBOSITY
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#ifndef SNMM
|
#ifndef SNMM
|
||||||
#define SUPPORT_VERBOSITY
|
#define SUPPORT_VERBOSITY
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
#define END_FILE_SECTION 20000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#ifndef SNMM
|
#ifndef SNMM
|
||||||
#define SUPPORT_VERBOSITY
|
#define SUPPORT_VERBOSITY
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue