Browse Source

Consolidate PrintCounter

Scott Lahteine 7 years ago
parent
commit
d5fe0fb02b

+ 2
- 8
Marlin/src/Marlin.cpp View File

@@ -39,12 +39,12 @@
39 39
 #include "module/temperature.h"
40 40
 #include "sd/cardreader.h"
41 41
 #include "module/configuration_store.h"
42
+#include "module/printcounter.h" // PrintCounter or Stopwatch
42 43
 #ifdef ARDUINO
43 44
   #include <pins_arduino.h>
44 45
 #endif
45 46
 #include <math.h>
46 47
 #include "libs/nozzle.h"
47
-#include "libs/duration_t.h"
48 48
 
49 49
 #include "gcode/gcode.h"
50 50
 #include "gcode/parser.h"
@@ -125,6 +125,7 @@
125 125
   #include "feature/tmc2130.h"
126 126
 #endif
127 127
 
128
+
128 129
 bool Running = true;
129 130
 
130 131
 /**
@@ -166,13 +167,6 @@ millis_t previous_cmd_ms = 0;
166 167
 static millis_t max_inactive_time = 0;
167 168
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
168 169
 
169
-// Print Job Timer
170
-#if ENABLED(PRINTCOUNTER)
171
-  PrintCounter print_job_timer = PrintCounter();
172
-#else
173
-  Stopwatch print_job_timer = Stopwatch();
174
-#endif
175
-
176 170
 #if ENABLED(Z_DUAL_ENDSTOPS)
177 171
   float z_endstop_adj;
178 172
 #endif

+ 0
- 13
Marlin/src/Marlin.h View File

@@ -32,12 +32,6 @@
32 32
   #include "gcode/parser.h"
33 33
 #endif
34 34
 
35
-#if ENABLED(PRINTCOUNTER)
36
-  #include "module/printcounter.h"
37
-#else
38
-  #include "libs/stopwatch.h"
39
-#endif
40
-
41 35
 void stop();
42 36
 
43 37
 void idle(
@@ -234,13 +228,6 @@ extern volatile bool wait_for_heatup;
234 228
   extern int lpq_len;
235 229
 #endif
236 230
 
237
-// Print job timer
238
-#if ENABLED(PRINTCOUNTER)
239
-  extern PrintCounter print_job_timer;
240
-#else
241
-  extern Stopwatch print_job_timer;
242
-#endif
243
-
244 231
 #if ENABLED(MIXING_EXTRUDER)
245 232
   extern float mixing_factor[MIXING_STEPPERS];
246 233
   #if MIXING_VIRTUAL_TOOLS > 1

+ 2
- 1
Marlin/src/feature/tmc2130.cpp View File

@@ -27,8 +27,9 @@
27 27
 #include "tmc2130.h"
28 28
 #include "../Marlin.h"
29 29
 
30
-#include "../libs/duration_t.h"
31 30
 #include "../module/stepper_indirection.h"
31
+#include "../module/printcounter.h"
32
+#include "../libs/duration_t.h"
32 33
 
33 34
 #ifdef AUTOMATIC_CURRENT_CONTROL
34 35
   bool auto_current_control = 0;

+ 1
- 0
Marlin/src/gcode/gcode.cpp View File

@@ -31,6 +31,7 @@ GcodeSuite gcode;
31 31
 #include "parser.h"
32 32
 #include "queue.h"
33 33
 #include "../module/motion.h"
34
+#include "../module/printcounter.h"
34 35
 
35 36
 #if ENABLED(PRINTCOUNTER)
36 37
   #include "../module/printcounter.h"

+ 2
- 2
Marlin/src/lcd/ultralcd.cpp View File

@@ -32,14 +32,14 @@
32 32
 #include "../module/stepper.h"
33 33
 #include "../module/motion.h"
34 34
 #include "../module/probe.h"
35
+#include "../module/printcounter.h"
35 36
 #include "../gcode/gcode.h"
36 37
 #include "../gcode/queue.h"
37 38
 #include "../module/configuration_store.h"
38 39
 
39 40
 #include "../Marlin.h"
40 41
 
41
-#if ENABLED(PRINTCOUNTER)
42
-  #include "../module/printcounter.h"
42
+#if ENABLED(PRINTCOUNTER) && ENABLED(LCD_INFO_MENU)
43 43
   #include "../libs/duration_t.h"
44 44
 #endif
45 45
 

+ 4
- 1
Marlin/src/lcd/ultralcd_impl_DOGM.h View File

@@ -47,7 +47,10 @@
47 47
 #endif
48 48
 
49 49
 #include "dogm/dogm_bitmaps.h"
50
-#include "../libs/duration_t.h"
50
+
51
+#if ENABLED(SDSUPPORT)
52
+  #include "../libs/duration_t.h"
53
+#endif
51 54
 
52 55
 #include <U8glib.h>
53 56
 

+ 15
- 3
Marlin/src/module/printcounter.cpp View File

@@ -20,6 +20,10 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(PRINTCOUNTER)
26
+
23 27
 #include "printcounter.h"
24 28
 
25 29
 #include "../Marlin.h"
@@ -95,7 +99,6 @@ void PrintCounter::saveStats() {
95 99
 
96 100
 void PrintCounter::showStats() {
97 101
   char buffer[21];
98
-  duration_t elapsed;
99 102
 
100 103
   SERIAL_PROTOCOLPGM(MSG_STATS);
101 104
 
@@ -112,7 +115,7 @@ void PrintCounter::showStats() {
112 115
   SERIAL_EOL();
113 116
   SERIAL_PROTOCOLPGM(MSG_STATS);
114 117
 
115
-  elapsed = this->data.printTime;
118
+  duration_t elapsed = this->data.printTime;
116 119
   elapsed.toString(buffer);
117 120
 
118 121
   SERIAL_ECHOPGM("Total time: ");
@@ -231,5 +234,14 @@ void PrintCounter::reset() {
231 234
       SERIAL_ECHOLNPGM("()");
232 235
     }
233 236
   }
234
-
235 237
 #endif
238
+
239
+
240
+PrintCounter print_job_timer = PrintCounter();
241
+
242
+#else
243
+
244
+#include "../libs/stopwatch.h"
245
+Stopwatch print_job_timer = Stopwatch();
246
+
247
+#endif // PRINTCOUNTER

+ 7
- 0
Marlin/src/module/printcounter.h View File

@@ -175,4 +175,11 @@ class PrintCounter: public Stopwatch {
175 175
     #endif
176 176
 };
177 177
 
178
+// Print Job Timer
179
+#if ENABLED(PRINTCOUNTER)
180
+  extern PrintCounter print_job_timer;
181
+#else
182
+  extern Stopwatch print_job_timer;
183
+#endif
184
+
178 185
 #endif // PRINTCOUNTER_H

Loading…
Cancel
Save