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() { inline void gcode_M31() {
millis_t t = print_job_timer.duration(); millis_t t = print_job_timer.duration();
int min = t / 60, sec = t % 60; int d = int(t / 60 / 60 / 24),
char time[30]; h = int(t / 60 / 60) % 60,
sprintf_P(time, PSTR("%i min, %i sec"), min, sec); m = int(t / 60) % 60,
SERIAL_ECHO_START; s = int(t % 60);
SERIAL_ECHOLN(time); 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); lcd_setstatus(time);
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
SERIAL_ECHOLN(time);
thermalManager.autotempShutdown(); thermalManager.autotempShutdown();
} }

View File

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