Browse Source

Consolidate PrintCounter

Scott Lahteine 7 years ago
parent
commit
d5fe0fb02b

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

39
 #include "module/temperature.h"
39
 #include "module/temperature.h"
40
 #include "sd/cardreader.h"
40
 #include "sd/cardreader.h"
41
 #include "module/configuration_store.h"
41
 #include "module/configuration_store.h"
42
+#include "module/printcounter.h" // PrintCounter or Stopwatch
42
 #ifdef ARDUINO
43
 #ifdef ARDUINO
43
   #include <pins_arduino.h>
44
   #include <pins_arduino.h>
44
 #endif
45
 #endif
45
 #include <math.h>
46
 #include <math.h>
46
 #include "libs/nozzle.h"
47
 #include "libs/nozzle.h"
47
-#include "libs/duration_t.h"
48
 
48
 
49
 #include "gcode/gcode.h"
49
 #include "gcode/gcode.h"
50
 #include "gcode/parser.h"
50
 #include "gcode/parser.h"
125
   #include "feature/tmc2130.h"
125
   #include "feature/tmc2130.h"
126
 #endif
126
 #endif
127
 
127
 
128
+
128
 bool Running = true;
129
 bool Running = true;
129
 
130
 
130
 /**
131
 /**
166
 static millis_t max_inactive_time = 0;
167
 static millis_t max_inactive_time = 0;
167
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
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
 #if ENABLED(Z_DUAL_ENDSTOPS)
170
 #if ENABLED(Z_DUAL_ENDSTOPS)
177
   float z_endstop_adj;
171
   float z_endstop_adj;
178
 #endif
172
 #endif

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

32
   #include "gcode/parser.h"
32
   #include "gcode/parser.h"
33
 #endif
33
 #endif
34
 
34
 
35
-#if ENABLED(PRINTCOUNTER)
36
-  #include "module/printcounter.h"
37
-#else
38
-  #include "libs/stopwatch.h"
39
-#endif
40
-
41
 void stop();
35
 void stop();
42
 
36
 
43
 void idle(
37
 void idle(
234
   extern int lpq_len;
228
   extern int lpq_len;
235
 #endif
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
 #if ENABLED(MIXING_EXTRUDER)
231
 #if ENABLED(MIXING_EXTRUDER)
245
   extern float mixing_factor[MIXING_STEPPERS];
232
   extern float mixing_factor[MIXING_STEPPERS];
246
   #if MIXING_VIRTUAL_TOOLS > 1
233
   #if MIXING_VIRTUAL_TOOLS > 1

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

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

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

31
 #include "parser.h"
31
 #include "parser.h"
32
 #include "queue.h"
32
 #include "queue.h"
33
 #include "../module/motion.h"
33
 #include "../module/motion.h"
34
+#include "../module/printcounter.h"
34
 
35
 
35
 #if ENABLED(PRINTCOUNTER)
36
 #if ENABLED(PRINTCOUNTER)
36
   #include "../module/printcounter.h"
37
   #include "../module/printcounter.h"

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

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

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

47
 #endif
47
 #endif
48
 
48
 
49
 #include "dogm/dogm_bitmaps.h"
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
 #include <U8glib.h>
55
 #include <U8glib.h>
53
 
56
 

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

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
+#include "../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(PRINTCOUNTER)
26
+
23
 #include "printcounter.h"
27
 #include "printcounter.h"
24
 
28
 
25
 #include "../Marlin.h"
29
 #include "../Marlin.h"
95
 
99
 
96
 void PrintCounter::showStats() {
100
 void PrintCounter::showStats() {
97
   char buffer[21];
101
   char buffer[21];
98
-  duration_t elapsed;
99
 
102
 
100
   SERIAL_PROTOCOLPGM(MSG_STATS);
103
   SERIAL_PROTOCOLPGM(MSG_STATS);
101
 
104
 
112
   SERIAL_EOL();
115
   SERIAL_EOL();
113
   SERIAL_PROTOCOLPGM(MSG_STATS);
116
   SERIAL_PROTOCOLPGM(MSG_STATS);
114
 
117
 
115
-  elapsed = this->data.printTime;
118
+  duration_t elapsed = this->data.printTime;
116
   elapsed.toString(buffer);
119
   elapsed.toString(buffer);
117
 
120
 
118
   SERIAL_ECHOPGM("Total time: ");
121
   SERIAL_ECHOPGM("Total time: ");
231
       SERIAL_ECHOLNPGM("()");
234
       SERIAL_ECHOLNPGM("()");
232
     }
235
     }
233
   }
236
   }
234
-
235
 #endif
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
     #endif
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
 #endif // PRINTCOUNTER_H
185
 #endif // PRINTCOUNTER_H

Loading…
Cancel
Save