Support longer print times in M31

This commit is contained in:
Scott Lahteine 2016-07-13 12:57:59 -07:00
parent e481b79af1
commit a8d71f0ac6
2 changed files with 22 additions and 5 deletions

View File

@ -3948,12 +3948,22 @@ inline void gcode_M17() {
*/
inline void gcode_M31() {
millis_t t = print_job_timer.duration();
int min = t / 60, sec = t % 60;
char time[30];
sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
int d = int(t / 60 / 60 / 24),
h = int(t / 60 / 60) % 60,
m = int(t / 60) % 60,
s = int(t % 60);
char time[18]; // 123456789012345678
if (d)
sprintf_P(time, PSTR("%id %ih %im %is"), d, h, m, s); // 99d 23h 59m 59s
else
sprintf_P(time, PSTR("%ih %im %is"), h, m, s); // 23h 59m 59s
lcd_setstatus(time);
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
SERIAL_ECHOLN(time);
thermalManager.autotempShutdown();
}

View File

@ -488,12 +488,18 @@
#ifndef MSG_PLEASE_RESET
#define MSG_PLEASE_RESET "Please reset"
#endif
#ifndef MSG_END_DAY
#define MSG_END_DAY "days"
#endif
#ifndef MSG_END_HOUR
#define MSG_END_HOUR "hours"
#endif
#ifndef MSG_END_MINUTE
#define MSG_END_MINUTE "minutes"
#endif
#ifndef MSG_PRINT_TIME
#define MSG_PRINT_TIME "Print time"
#endif
#ifndef MSG_HEATING
#define MSG_HEATING "Heating..."
#endif
@ -521,6 +527,7 @@
#ifndef MSG_DELTA_CALIBRATE_CENTER
#define MSG_DELTA_CALIBRATE_CENTER "Calibrate Center"
#endif
#ifndef MSG_INFO_MENU
#define MSG_INFO_MENU "About Printer"
#endif