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

@ -39,12 +39,12 @@
#include "module/temperature.h"
#include "sd/cardreader.h"
#include "module/configuration_store.h"
#include "module/printcounter.h" // PrintCounter or Stopwatch
#ifdef ARDUINO
#include <pins_arduino.h>
#endif
#include <math.h>
#include "libs/nozzle.h"
#include "libs/duration_t.h"
#include "gcode/gcode.h"
#include "gcode/parser.h"
@ -125,6 +125,7 @@
#include "feature/tmc2130.h"
#endif
bool Running = true;
/**
@ -166,13 +167,6 @@ millis_t previous_cmd_ms = 0;
static millis_t max_inactive_time = 0;
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
// Print Job Timer
#if ENABLED(PRINTCOUNTER)
PrintCounter print_job_timer = PrintCounter();
#else
Stopwatch print_job_timer = Stopwatch();
#endif
#if ENABLED(Z_DUAL_ENDSTOPS)
float z_endstop_adj;
#endif

View file

@ -32,12 +32,6 @@
#include "gcode/parser.h"
#endif
#if ENABLED(PRINTCOUNTER)
#include "module/printcounter.h"
#else
#include "libs/stopwatch.h"
#endif
void stop();
void idle(
@ -234,13 +228,6 @@ extern volatile bool wait_for_heatup;
extern int lpq_len;
#endif
// Print job timer
#if ENABLED(PRINTCOUNTER)
extern PrintCounter print_job_timer;
#else
extern Stopwatch print_job_timer;
#endif
#if ENABLED(MIXING_EXTRUDER)
extern float mixing_factor[MIXING_STEPPERS];
#if MIXING_VIRTUAL_TOOLS > 1

View file

@ -27,8 +27,9 @@
#include "tmc2130.h"
#include "../Marlin.h"
#include "../libs/duration_t.h"
#include "../module/stepper_indirection.h"
#include "../module/printcounter.h"
#include "../libs/duration_t.h"
#ifdef AUTOMATIC_CURRENT_CONTROL
bool auto_current_control = 0;

View file

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

View file

@ -32,14 +32,14 @@
#include "../module/stepper.h"
#include "../module/motion.h"
#include "../module/probe.h"
#include "../module/printcounter.h"
#include "../gcode/gcode.h"
#include "../gcode/queue.h"
#include "../module/configuration_store.h"
#include "../Marlin.h"
#if ENABLED(PRINTCOUNTER)
#include "../module/printcounter.h"
#if ENABLED(PRINTCOUNTER) && ENABLED(LCD_INFO_MENU)
#include "../libs/duration_t.h"
#endif

View file

@ -47,7 +47,10 @@
#endif
#include "dogm/dogm_bitmaps.h"
#include "../libs/duration_t.h"
#if ENABLED(SDSUPPORT)
#include "../libs/duration_t.h"
#endif
#include <U8glib.h>

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