Consolidate PrintCounter

This commit is contained in:
Scott Lahteine
2017-09-09 00:18:43 -05:00
parent 551752eac7
commit d5fe0fb02b
8 changed files with 33 additions and 28 deletions

View File

@ -20,6 +20,10 @@
*
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(PRINTCOUNTER)
#include "printcounter.h"
#include "../Marlin.h"
@ -95,7 +99,6 @@ void PrintCounter::saveStats() {
void PrintCounter::showStats() {
char buffer[21];
duration_t elapsed;
SERIAL_PROTOCOLPGM(MSG_STATS);
@ -112,7 +115,7 @@ void PrintCounter::showStats() {
SERIAL_EOL();
SERIAL_PROTOCOLPGM(MSG_STATS);
elapsed = this->data.printTime;
duration_t elapsed = this->data.printTime;
elapsed.toString(buffer);
SERIAL_ECHOPGM("Total time: ");
@ -231,5 +234,14 @@ void PrintCounter::reset() {
SERIAL_ECHOLNPGM("()");
}
}
#endif
PrintCounter print_job_timer = PrintCounter();
#else
#include "../libs/stopwatch.h"
Stopwatch print_job_timer = Stopwatch();
#endif // PRINTCOUNTER

View File

@ -175,4 +175,11 @@ class PrintCounter: public Stopwatch {
#endif
};
// Print Job Timer
#if ENABLED(PRINTCOUNTER)
extern PrintCounter print_job_timer;
#else
extern Stopwatch print_job_timer;
#endif
#endif // PRINTCOUNTER_H