Browse Source

Support longer print times in M31

pull/1/head
Scott Lahteine 9 years ago
parent
commit
a8d71f0ac6
  1. 18
      Marlin/Marlin_main.cpp
  2. 7
      Marlin/language_en.h

18
Marlin/Marlin_main.cpp

@ -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,
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_ECHO_START;
SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
lcd_setstatus(time);
thermalManager.autotempShutdown(); thermalManager.autotempShutdown();
} }

7
Marlin/language_en.h

@ -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

Loading…
Cancel
Save