Browse Source

Merge pull request #4287 from thinkyhead/rc_long_print_times

Allow stopwatch and printcounter to go over 18:12:15
Scott Lahteine 8 years ago
parent
commit
75901b616c

+ 14
- 12
Marlin/Marlin_main.cpp View File

1169
       ) {
1169
       ) {
1170
         if (card_eof) {
1170
         if (card_eof) {
1171
           SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
1171
           SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
1172
-          print_job_timer.stop();
1173
-          char time[30];
1174
-          millis_t t = print_job_timer.duration();
1175
-          int hours = t / 60 / 60, minutes = (t / 60) % 60;
1176
-          sprintf_P(time, PSTR("%i " MSG_END_HOUR " %i " MSG_END_MINUTE), hours, minutes);
1177
-          SERIAL_ECHO_START;
1178
-          SERIAL_ECHOLN(time);
1179
-          lcd_setstatus(time, true);
1180
           card.printingHasFinished();
1172
           card.printingHasFinished();
1181
           card.checkautostart(true);
1173
           card.checkautostart(true);
1182
         }
1174
         }
3949
  */
3941
  */
3950
 inline void gcode_M31() {
3942
 inline void gcode_M31() {
3951
   millis_t t = print_job_timer.duration();
3943
   millis_t t = print_job_timer.duration();
3952
-  int min = t / 60, sec = t % 60;
3953
-  char time[30];
3954
-  sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
3944
+  int d = int(t / 60 / 60 / 24),
3945
+      h = int(t / 60 / 60) % 60,
3946
+      m = int(t / 60) % 60,
3947
+      s = int(t % 60);
3948
+  char time[18];                                          // 123456789012345678
3949
+  if (d)
3950
+    sprintf_P(time, PSTR("%id %ih %im %is"), d, h, m, s); // 99d 23h 59m 59s
3951
+  else
3952
+    sprintf_P(time, PSTR("%ih %im %is"), h, m, s);        // 23h 59m 59s
3953
+
3954
+  lcd_setstatus(time);
3955
+
3955
   SERIAL_ECHO_START;
3956
   SERIAL_ECHO_START;
3957
+  SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
3956
   SERIAL_ECHOLN(time);
3958
   SERIAL_ECHOLN(time);
3957
-  lcd_setstatus(time);
3959
+
3958
   thermalManager.autotempShutdown();
3960
   thermalManager.autotempShutdown();
3959
 }
3961
 }
3960
 
3962
 

+ 3
- 3
Marlin/cardreader.cpp View File

602
 
602
 
603
 void CardReader::printingHasFinished() {
603
 void CardReader::printingHasFinished() {
604
   stepper.synchronize();
604
   stepper.synchronize();
605
+  file.close();
605
   if (file_subcall_ctr > 0) { // Heading up to a parent file that called current as a procedure.
606
   if (file_subcall_ctr > 0) { // Heading up to a parent file that called current as a procedure.
606
-    file.close();
607
     file_subcall_ctr--;
607
     file_subcall_ctr--;
608
     openFile(proc_filenames[file_subcall_ctr], true, true);
608
     openFile(proc_filenames[file_subcall_ctr], true, true);
609
     setIndex(filespos[file_subcall_ctr]);
609
     setIndex(filespos[file_subcall_ctr]);
610
     startFileprint();
610
     startFileprint();
611
   }
611
   }
612
   else {
612
   else {
613
-    file.close();
614
     sdprinting = false;
613
     sdprinting = false;
615
     if (SD_FINISHED_STEPPERRELEASE)
614
     if (SD_FINISHED_STEPPERRELEASE)
616
       enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
615
       enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
617
-    thermalManager.autotempShutdown();
616
+    print_job_timer.stop();
617
+    enqueue_and_echo_commands_P(PSTR("M31"));
618
   }
618
   }
619
 }
619
 }
620
 
620
 

+ 1
- 1
Marlin/dogm_lcd_implementation.h View File

386
     }
386
     }
387
 
387
 
388
     u8g.setPrintPos(80,48);
388
     u8g.setPrintPos(80,48);
389
-    uint16_t time = print_job_timer.duration() / 60;
389
+    millis_t time = print_job_timer.duration() / 60;
390
     if (time != 0) {
390
     if (time != 0) {
391
       lcd_print(itostr2(time/60));
391
       lcd_print(itostr2(time/60));
392
       lcd_print(':');
392
       lcd_print(':');

+ 6
- 6
Marlin/language_cz.h View File

209
 #define MSG_INFO_BAUDRATE                   "Rychlost"
209
 #define MSG_INFO_BAUDRATE                   "Rychlost"
210
 #define MSG_INFO_PROTOCOL                   "Protokol"
210
 #define MSG_INFO_PROTOCOL                   "Protokol"
211
 #if LCD_WIDTH > 19
211
 #if LCD_WIDTH > 19
212
-  #define MSG_INFO_PRINT_COUNT              "Pocet tisku "
213
-  #define MSG_INFO_FINISHED_PRINTS          "Dokonceno   "
214
-  #define MSG_INFO_PRINT_TIME               "Celkovy cas "
212
+  #define MSG_INFO_PRINT_COUNT              "Pocet tisku"
213
+  #define MSG_INFO_COMPLETED_PRINTS         "Dokonceno  "
214
+  #define MSG_INFO_PRINT_TIME               "Celkovy cas"
215
 #else
215
 #else
216
-  #define MSG_INFO_PRINT_COUNT              "Tisky    "
217
-  #define MSG_INFO_FINISHED_PRINTS          "Hotovo   "
218
-  #define MSG_INFO_PRINT_TIME               "Cas      "
216
+  #define MSG_INFO_PRINT_COUNT              "Tisky "
217
+  #define MSG_INFO_COMPLETED_PRINTS         "Hotovo"
218
+  #define MSG_INFO_PRINT_TIME               "Cas   "
219
 #endif
219
 #endif
220
 #define MSG_INFO_MIN_TEMP                   "Teplota min"
220
 #define MSG_INFO_MIN_TEMP                   "Teplota min"
221
 #define MSG_INFO_MAX_TEMP                   "Teplota max"
221
 #define MSG_INFO_MAX_TEMP                   "Teplota max"

+ 10
- 3
Marlin/language_de.h View File

179
 #define MSG_INFO_EXTRUDERS                  "Extruders"
179
 #define MSG_INFO_EXTRUDERS                  "Extruders"
180
 #define MSG_INFO_BAUDRATE                   "Baud"
180
 #define MSG_INFO_BAUDRATE                   "Baud"
181
 #define MSG_INFO_PROTOCOL                   "Protokol"
181
 #define MSG_INFO_PROTOCOL                   "Protokol"
182
-#define MSG_INFO_TOTAL_PRINTS               "Gesamte Drucke"
183
-#define MSG_INFO_FINISHED_PRINTS            "Beendete Drucke"
184
-#define MSG_INFO_PRINT_TIME                 "Gesamte Druckzeit"
182
+
183
+#if LCD_WIDTH > 19
184
+  #define MSG_INFO_TOTAL_PRINTS             "Gesamte Drucke   "
185
+  #define MSG_INFO_COMPLETED_PRINTS         "Beendete Drucke  "
186
+  #define MSG_INFO_PRINT_TIME               "Gesamte Druckzeit"
187
+#else
188
+  #define MSG_INFO_PRINT_COUNT              "Prints   "
189
+  #define MSG_INFO_COMPLETED_PRINTS         "Completed"
190
+  #define MSG_INFO_PRINT_TIME               "Duration "
191
+#endif
185
 #define MSG_INFO_MIN_TEMP                   "Min Temp"
192
 #define MSG_INFO_MIN_TEMP                   "Min Temp"
186
 #define MSG_INFO_MAX_TEMP                   "Max Temp"
193
 #define MSG_INFO_MAX_TEMP                   "Max Temp"
187
 #define MSG_INFO_PSU                        "Stromversorgung"
194
 #define MSG_INFO_PSU                        "Stromversorgung"

+ 36
- 27
Marlin/language_el.h View File

198
 #define MSG_DELTA_CALIBRATE_Y               "Βαθμονόμηση Y"
198
 #define MSG_DELTA_CALIBRATE_Y               "Βαθμονόμηση Y"
199
 #define MSG_DELTA_CALIBRATE_Z               "Βαθμονόμηση Z"
199
 #define MSG_DELTA_CALIBRATE_Z               "Βαθμονόμηση Z"
200
 #define MSG_DELTA_CALIBRATE_CENTER          "Βαθμονόμηση κέντρου"
200
 #define MSG_DELTA_CALIBRATE_CENTER          "Βαθμονόμηση κέντρου"
201
+
201
 #define MSG_INFO_MENU                       "About Printer"
202
 #define MSG_INFO_MENU                       "About Printer"
202
 #define MSG_INFO_PRINTER_MENU               "Printer Info"
203
 #define MSG_INFO_PRINTER_MENU               "Printer Info"
203
 #define MSG_INFO_STATS_MENU                 "Printer Stats"
204
 #define MSG_INFO_STATS_MENU                 "Printer Stats"
206
 #define MSG_INFO_EXTRUDERS                  "Extruders"
207
 #define MSG_INFO_EXTRUDERS                  "Extruders"
207
 #define MSG_INFO_BAUDRATE                   "Baud"
208
 #define MSG_INFO_BAUDRATE                   "Baud"
208
 #define MSG_INFO_PROTOCOL                   "Protocol"
209
 #define MSG_INFO_PROTOCOL                   "Protocol"
209
-#define MSG_INFO_TOTAL_PRINTS               "Total Prints"
210
-#define MSG_INFO_FINISHED_PRINTS            "Finished Prints"
211
-#define MSG_INFO_PRINT_TIME                 "Total Print Time"
210
+
211
+#if LCD_WIDTH > 19
212
+  #define MSG_INFO_PRINT_COUNT              "Print Count"
213
+  #define MSG_INFO_COMPLETED_PRINTS         "Completed  "
214
+  #define MSG_INFO_PRINT_TIME               "Total Time "
215
+#else
216
+  #define MSG_INFO_PRINT_COUNT              "Prints   "
217
+  #define MSG_INFO_COMPLETED_PRINTS         "Completed"
218
+  #define MSG_INFO_PRINT_TIME               "Duration "
219
+#endif
212
 #define MSG_INFO_MIN_TEMP                   "Min Temp"
220
 #define MSG_INFO_MIN_TEMP                   "Min Temp"
213
 #define MSG_INFO_MAX_TEMP                   "Max Temp"
221
 #define MSG_INFO_MAX_TEMP                   "Max Temp"
214
 #define MSG_INFO_PSU                        "Power Supply"
222
 #define MSG_INFO_PSU                        "Power Supply"
223
+
215
 #define MSG_FILAMENT_CHANGE_HEADER          "CHANGE FILAMENT"
224
 #define MSG_FILAMENT_CHANGE_HEADER          "CHANGE FILAMENT"
216
 #define MSG_FILAMENT_CHANGE_OPTION_EXTRUDE  "Extrude more"
225
 #define MSG_FILAMENT_CHANGE_OPTION_EXTRUDE  "Extrude more"
217
 #define MSG_FILAMENT_CHANGE_OPTION_RESUME   "Resume print"
226
 #define MSG_FILAMENT_CHANGE_OPTION_RESUME   "Resume print"
218
 
227
 
219
 #if LCD_HEIGHT >= 4
228
 #if LCD_HEIGHT >= 4
220
-  #define MSG_FILAMENT_CHANGE_INIT_1          "Wait for start"
221
-  #define MSG_FILAMENT_CHANGE_INIT_2          "of the filament"
222
-  #define MSG_FILAMENT_CHANGE_INIT_3          "change"
223
-  #define MSG_FILAMENT_CHANGE_UNLOAD_1        "Wait for"
224
-  #define MSG_FILAMENT_CHANGE_UNLOAD_2        "filament unload"
225
-  #define MSG_FILAMENT_CHANGE_UNLOAD_3        ""
226
-  #define MSG_FILAMENT_CHANGE_INSERT_1        "Insert filament"
227
-  #define MSG_FILAMENT_CHANGE_INSERT_2        "and press button"
228
-  #define MSG_FILAMENT_CHANGE_INSERT_3        "to continue..."
229
-  #define MSG_FILAMENT_CHANGE_LOAD_1          "Wait for"
230
-  #define MSG_FILAMENT_CHANGE_LOAD_2          "filament load"
231
-  #define MSG_FILAMENT_CHANGE_LOAD_3          ""
232
-  #define MSG_FILAMENT_CHANGE_EXTRUDE_1       "Wait for"
233
-  #define MSG_FILAMENT_CHANGE_EXTRUDE_2       "filament extrude"
234
-  #define MSG_FILAMENT_CHANGE_EXTRUDE_3       ""
235
-  #define MSG_FILAMENT_CHANGE_RESUME_1        "Wait for print"
236
-  #define MSG_FILAMENT_CHANGE_RESUME_2        "to resume"
237
-  #define MSG_FILAMENT_CHANGE_RESUME_3        ""
229
+  #define MSG_FILAMENT_CHANGE_INIT_1        "Wait for start"
230
+  #define MSG_FILAMENT_CHANGE_INIT_2        "of the filament"
231
+  #define MSG_FILAMENT_CHANGE_INIT_3        "change"
232
+  #define MSG_FILAMENT_CHANGE_UNLOAD_1      "Wait for"
233
+  #define MSG_FILAMENT_CHANGE_UNLOAD_2      "filament unload"
234
+  #define MSG_FILAMENT_CHANGE_UNLOAD_3      ""
235
+  #define MSG_FILAMENT_CHANGE_INSERT_1      "Insert filament"
236
+  #define MSG_FILAMENT_CHANGE_INSERT_2      "and press button"
237
+  #define MSG_FILAMENT_CHANGE_INSERT_3      "to continue..."
238
+  #define MSG_FILAMENT_CHANGE_LOAD_1        "Wait for"
239
+  #define MSG_FILAMENT_CHANGE_LOAD_2        "filament load"
240
+  #define MSG_FILAMENT_CHANGE_LOAD_3        ""
241
+  #define MSG_FILAMENT_CHANGE_EXTRUDE_1     "Wait for"
242
+  #define MSG_FILAMENT_CHANGE_EXTRUDE_2     "filament extrude"
243
+  #define MSG_FILAMENT_CHANGE_EXTRUDE_3     ""
244
+  #define MSG_FILAMENT_CHANGE_RESUME_1      "Wait for print"
245
+  #define MSG_FILAMENT_CHANGE_RESUME_2      "to resume"
246
+  #define MSG_FILAMENT_CHANGE_RESUME_3      ""
238
 #else // LCD_HEIGHT < 4
247
 #else // LCD_HEIGHT < 4
239
-  #define MSG_FILAMENT_CHANGE_INIT_1          "Please wait..."
240
-  #define MSG_FILAMENT_CHANGE_UNLOAD_1        "Ejecting..."
241
-  #define MSG_FILAMENT_CHANGE_INSERT_1        "Insert and Click"
242
-  #define MSG_FILAMENT_CHANGE_LOAD_1          "Loading..."
243
-  #define MSG_FILAMENT_CHANGE_EXTRUDE_1       "Extruding..."
244
-  #define MSG_FILAMENT_CHANGE_RESUME_1        "Resuming..."
248
+  #define MSG_FILAMENT_CHANGE_INIT_1        "Please wait..."
249
+  #define MSG_FILAMENT_CHANGE_UNLOAD_1      "Ejecting..."
250
+  #define MSG_FILAMENT_CHANGE_INSERT_1      "Insert and Click"
251
+  #define MSG_FILAMENT_CHANGE_LOAD_1        "Loading..."
252
+  #define MSG_FILAMENT_CHANGE_EXTRUDE_1     "Extruding..."
253
+  #define MSG_FILAMENT_CHANGE_RESUME_1      "Resuming..."
245
 #endif
254
 #endif
246
 
255
 
247
 #endif // LANGUAGE_EL_H
256
 #endif // LANGUAGE_EL_H

+ 13
- 6
Marlin/language_en.h View File

488
 #ifndef MSG_PLEASE_RESET
488
 #ifndef MSG_PLEASE_RESET
489
   #define MSG_PLEASE_RESET                    "Please reset"
489
   #define MSG_PLEASE_RESET                    "Please reset"
490
 #endif
490
 #endif
491
+#ifndef MSG_END_DAY
492
+  #define MSG_END_DAY                         "days"
493
+#endif
491
 #ifndef MSG_END_HOUR
494
 #ifndef MSG_END_HOUR
492
   #define MSG_END_HOUR                        "hours"
495
   #define MSG_END_HOUR                        "hours"
493
 #endif
496
 #endif
494
 #ifndef MSG_END_MINUTE
497
 #ifndef MSG_END_MINUTE
495
   #define MSG_END_MINUTE                      "minutes"
498
   #define MSG_END_MINUTE                      "minutes"
496
 #endif
499
 #endif
500
+#ifndef MSG_PRINT_TIME
501
+  #define MSG_PRINT_TIME                      "Print time"
502
+#endif
497
 #ifndef MSG_HEATING
503
 #ifndef MSG_HEATING
498
   #define MSG_HEATING                         "Heating..."
504
   #define MSG_HEATING                         "Heating..."
499
 #endif
505
 #endif
521
 #ifndef MSG_DELTA_CALIBRATE_CENTER
527
 #ifndef MSG_DELTA_CALIBRATE_CENTER
522
   #define MSG_DELTA_CALIBRATE_CENTER          "Calibrate Center"
528
   #define MSG_DELTA_CALIBRATE_CENTER          "Calibrate Center"
523
 #endif
529
 #endif
530
+
524
 #ifndef MSG_INFO_MENU
531
 #ifndef MSG_INFO_MENU
525
   #define MSG_INFO_MENU                       "About Printer"
532
   #define MSG_INFO_MENU                       "About Printer"
526
 #endif
533
 #endif
548
 
555
 
549
 #if LCD_WIDTH > 19
556
 #if LCD_WIDTH > 19
550
   #ifndef MSG_INFO_PRINT_COUNT
557
   #ifndef MSG_INFO_PRINT_COUNT
551
-    #define MSG_INFO_PRINT_COUNT              "Print Count "
558
+    #define MSG_INFO_PRINT_COUNT              "Print Count"
552
   #endif
559
   #endif
553
-  #ifndef MSG_INFO_FINISHED_PRINTS
554
-    #define MSG_INFO_FINISHED_PRINTS          "Finished    "
560
+  #ifndef MSG_INFO_COMPLETED_PRINTS
561
+    #define MSG_INFO_COMPLETED_PRINTS         "Completed  "
555
   #endif
562
   #endif
556
   #ifndef MSG_INFO_PRINT_TIME
563
   #ifndef MSG_INFO_PRINT_TIME
557
-    #define MSG_INFO_PRINT_TIME               "Total Time  "
564
+    #define MSG_INFO_PRINT_TIME               "Total Time "
558
   #endif
565
   #endif
559
 #else
566
 #else
560
   #ifndef MSG_INFO_PRINT_COUNT
567
   #ifndef MSG_INFO_PRINT_COUNT
561
     #define MSG_INFO_PRINT_COUNT              "Prints   "
568
     #define MSG_INFO_PRINT_COUNT              "Prints   "
562
   #endif
569
   #endif
563
-  #ifndef MSG_INFO_FINISHED_PRINTS
564
-    #define MSG_INFO_FINISHED_PRINTS          "Finished "
570
+  #ifndef MSG_INFO_COMPLETED_PRINTS
571
+    #define MSG_INFO_COMPLETED_PRINTS         "Completed"
565
   #endif
572
   #endif
566
   #ifndef MSG_INFO_PRINT_TIME
573
   #ifndef MSG_INFO_PRINT_TIME
567
     #define MSG_INFO_PRINT_TIME               "Duration "
574
     #define MSG_INFO_PRINT_TIME               "Duration "

+ 8
- 9
Marlin/printcounter.cpp View File

27
   this->loadStats();
27
   this->loadStats();
28
 }
28
 }
29
 
29
 
30
-uint16_t PrintCounter::deltaDuration() {
30
+millis_t PrintCounter::deltaDuration() {
31
   #if ENABLED(DEBUG_PRINTCOUNTER)
31
   #if ENABLED(DEBUG_PRINTCOUNTER)
32
     PrintCounter::debug(PSTR("deltaDuration"));
32
     PrintCounter::debug(PSTR("deltaDuration"));
33
   #endif
33
   #endif
34
 
34
 
35
-  uint16_t tmp = this->lastDuration;
35
+  millis_t tmp = this->lastDuration;
36
   this->lastDuration = this->duration();
36
   this->lastDuration = this->duration();
37
   return this->lastDuration - tmp;
37
   return this->lastDuration - tmp;
38
 }
38
 }
88
   SERIAL_ECHO(this->data.totalPrints - this->data.finishedPrints
88
   SERIAL_ECHO(this->data.totalPrints - this->data.finishedPrints
89
     - ((this->isRunning() || this->isPaused()) ? 1 : 0)); // Removes 1 from failures with an active counter
89
     - ((this->isRunning() || this->isPaused()) ? 1 : 0)); // Removes 1 from failures with an active counter
90
 
90
 
91
-  uint32_t t = this->data.printTime / 60;
91
+  millis_t t = this->data.printTime / 60; // minutes from seconds
92
   SERIAL_ECHOPGM(", Total print time: ");
92
   SERIAL_ECHOPGM(", Total print time: ");
93
-  SERIAL_ECHO(t / 60);
93
+  SERIAL_ECHO(t / 60); // hours
94
 
94
 
95
   SERIAL_ECHOPGM("h ");
95
   SERIAL_ECHOPGM("h ");
96
-  SERIAL_ECHO(t % 60);
96
+  SERIAL_ECHO(t % 60); // minutes
97
 
97
 
98
   SERIAL_ECHOPGM("min");
98
   SERIAL_ECHOPGM("min");
99
 
99
 
110
 void PrintCounter::tick() {
110
 void PrintCounter::tick() {
111
   if (!this->isRunning()) return;
111
   if (!this->isRunning()) return;
112
 
112
 
113
-  static uint32_t update_before = millis(),
113
+  static millis_t update_before = millis(),
114
                   eeprom_before = millis();
114
                   eeprom_before = millis();
115
 
115
 
116
-  uint32_t now = millis();
116
+  millis_t now = millis();
117
 
117
 
118
   // Trying to get the amount of calculations down to the bare min
118
   // Trying to get the amount of calculations down to the bare min
119
   const static uint16_t i = this->updateInterval * 1000;
119
   const static uint16_t i = this->updateInterval * 1000;
128
   }
128
   }
129
 
129
 
130
   // Trying to get the amount of calculations down to the bare min
130
   // Trying to get the amount of calculations down to the bare min
131
-  const static uint32_t j = this->saveInterval * 1000;
132
-
131
+  const static millis_t j = this->saveInterval * 1000;
133
   if (now - eeprom_before >= j) {
132
   if (now - eeprom_before >= j) {
134
     eeprom_before = now;
133
     eeprom_before = now;
135
     this->saveStats();
134
     this->saveStats();

+ 4
- 4
Marlin/printcounter.h View File

35
   //const uint8_t magic;    // Magic header, it will always be 0x16
35
   //const uint8_t magic;    // Magic header, it will always be 0x16
36
   uint16_t totalPrints;     // Number of prints
36
   uint16_t totalPrints;     // Number of prints
37
   uint16_t finishedPrints;  // Number of complete prints
37
   uint16_t finishedPrints;  // Number of complete prints
38
-  uint32_t printTime;       // Total printing time
39
-  uint32_t longestPrint;    // Longest print job - not in use
38
+  millis_t printTime;       // Total printing time
39
+  millis_t longestPrint;    // Longest print job - not in use
40
 };
40
 };
41
 
41
 
42
 class PrintCounter: public Stopwatch {
42
 class PrintCounter: public Stopwatch {
74
      * @details Stores the timestamp of the last deltaDuration(), this is
74
      * @details Stores the timestamp of the last deltaDuration(), this is
75
      * required due to the updateInterval cycle.
75
      * required due to the updateInterval cycle.
76
      */
76
      */
77
-    uint16_t lastDuration;
77
+    millis_t lastDuration;
78
 
78
 
79
     /**
79
     /**
80
      * @brief Stats were loaded from EERPROM
80
      * @brief Stats were loaded from EERPROM
90
      * used internally for print statistics accounting is not intended to be a
90
      * used internally for print statistics accounting is not intended to be a
91
      * user callable function.
91
      * user callable function.
92
      */
92
      */
93
-    uint16_t deltaDuration();
93
+    millis_t deltaDuration();
94
 
94
 
95
   public:
95
   public:
96
     /**
96
     /**

+ 2
- 2
Marlin/stopwatch.cpp View File

88
   return (this->state == STOPWATCH_PAUSED) ? true : false;
88
   return (this->state == STOPWATCH_PAUSED) ? true : false;
89
 }
89
 }
90
 
90
 
91
-uint16_t Stopwatch::duration() {
91
+millis_t Stopwatch::duration() {
92
   return (((this->isRunning()) ? millis() : this->stopTimestamp)
92
   return (((this->isRunning()) ? millis() : this->stopTimestamp)
93
-          - this->startTimestamp) / 1000 + this->accumulator;
93
+          - this->startTimestamp) / 1000UL + this->accumulator;
94
 }
94
 }
95
 
95
 
96
 #if ENABLED(DEBUG_STOPWATCH)
96
 #if ENABLED(DEBUG_STOPWATCH)

+ 4
- 4
Marlin/stopwatch.h View File

42
 class Stopwatch {
42
 class Stopwatch {
43
   private:
43
   private:
44
     StopwatchState state;
44
     StopwatchState state;
45
-    uint16_t accumulator;
46
-    uint32_t startTimestamp;
47
-    uint32_t stopTimestamp;
45
+    millis_t accumulator;
46
+    millis_t startTimestamp;
47
+    millis_t stopTimestamp;
48
 
48
 
49
   public:
49
   public:
50
     /**
50
     /**
101
      * @details Returns the total number of seconds the timer has been running.
101
      * @details Returns the total number of seconds the timer has been running.
102
      * @return the delta since starting the stopwatch
102
      * @return the delta since starting the stopwatch
103
      */
103
      */
104
-    uint16_t duration();
104
+    millis_t duration();
105
 
105
 
106
     #if ENABLED(DEBUG_STOPWATCH)
106
     #if ENABLED(DEBUG_STOPWATCH)
107
 
107
 

+ 6
- 6
Marlin/ultralcd.cpp View File

1967
         print_job_counter.loadStats();
1967
         print_job_counter.loadStats();
1968
         printStatistics stats = print_job_counter.getStats();
1968
         printStatistics stats = print_job_counter.getStats();
1969
 
1969
 
1970
-        char printTime[6];
1971
-        sprintf(printTime, "%02d:%02d", int(stats.printTime / 3600), int(stats.printTime / 60) % 60);
1970
+        char timeString[8];
1971
+        sprintf_P(timeString, PSTR("%i:%02i"), int(stats.printTime / 60 / 60), int(stats.printTime / 60) % 60);
1972
 
1972
 
1973
-        START_SCREEN();
1974
-        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count : 999
1975
-        STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", false, false, itostr3left(stats.finishedPrints)); // Finished    : 666
1976
-        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false, printTime);                              // Total Time  : 12:34
1973
+        START_SCREEN();                                                                              // 12345678901234567890
1974
+        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count: 999
1975
+        STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
1976
+        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false, timeString);                             // Total Time : 123:45
1977
         END_SCREEN();
1977
         END_SCREEN();
1978
       }
1978
       }
1979
     #endif // PRINTCOUNTER
1979
     #endif // PRINTCOUNTER

Loading…
Cancel
Save