Explorar el Código

Support longer print times in M31

Scott Lahteine hace 9 años
padre
commit
a8d71f0ac6
Se han modificado 2 ficheros con 21 adiciones y 4 borrados
  1. 14
    4
      Marlin/Marlin_main.cpp
  2. 7
    0
      Marlin/language_en.h

+ 14
- 4
Marlin/Marlin_main.cpp Ver fichero

@@ -3948,12 +3948,22 @@ inline void gcode_M17() {
3948 3948
  */
3949 3949
 inline void gcode_M31() {
3950 3950
   millis_t t = print_job_timer.duration();
3951
-  int min = t / 60, sec = t % 60;
3952
-  char time[30];
3953
-  sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
3951
+  int d = int(t / 60 / 60 / 24),
3952
+      h = int(t / 60 / 60) % 60,
3953
+      m = int(t / 60) % 60,
3954
+      s = int(t % 60);
3955
+  char time[18];                                          // 123456789012345678
3956
+  if (d)
3957
+    sprintf_P(time, PSTR("%id %ih %im %is"), d, h, m, s); // 99d 23h 59m 59s
3958
+  else
3959
+    sprintf_P(time, PSTR("%ih %im %is"), h, m, s);        // 23h 59m 59s
3960
+
3961
+  lcd_setstatus(time);
3962
+
3954 3963
   SERIAL_ECHO_START;
3964
+  SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
3955 3965
   SERIAL_ECHOLN(time);
3956
-  lcd_setstatus(time);
3966
+
3957 3967
   thermalManager.autotempShutdown();
3958 3968
 }
3959 3969
 

+ 7
- 0
Marlin/language_en.h Ver fichero

@@ -488,12 +488,18 @@
488 488
 #ifndef MSG_PLEASE_RESET
489 489
   #define MSG_PLEASE_RESET                    "Please reset"
490 490
 #endif
491
+#ifndef MSG_END_DAY
492
+  #define MSG_END_DAY                         "days"
493
+#endif
491 494
 #ifndef MSG_END_HOUR
492 495
   #define MSG_END_HOUR                        "hours"
493 496
 #endif
494 497
 #ifndef MSG_END_MINUTE
495 498
   #define MSG_END_MINUTE                      "minutes"
496 499
 #endif
500
+#ifndef MSG_PRINT_TIME
501
+  #define MSG_PRINT_TIME                      "Print time"
502
+#endif
497 503
 #ifndef MSG_HEATING
498 504
   #define MSG_HEATING                         "Heating..."
499 505
 #endif
@@ -521,6 +527,7 @@
521 527
 #ifndef MSG_DELTA_CALIBRATE_CENTER
522 528
   #define MSG_DELTA_CALIBRATE_CENTER          "Calibrate Center"
523 529
 #endif
530
+
524 531
 #ifndef MSG_INFO_MENU
525 532
   #define MSG_INFO_MENU                       "About Printer"
526 533
 #endif

Loading…
Cancelar
Guardar