Consolidate PrintCounter
This commit is contained in:
parent
551752eac7
commit
d5fe0fb02b
8 changed files with 33 additions and 28 deletions
|
@ -39,12 +39,12 @@
|
||||||
#include "module/temperature.h"
|
#include "module/temperature.h"
|
||||||
#include "sd/cardreader.h"
|
#include "sd/cardreader.h"
|
||||||
#include "module/configuration_store.h"
|
#include "module/configuration_store.h"
|
||||||
|
#include "module/printcounter.h" // PrintCounter or Stopwatch
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
#include <pins_arduino.h>
|
#include <pins_arduino.h>
|
||||||
#endif
|
#endif
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "libs/nozzle.h"
|
#include "libs/nozzle.h"
|
||||||
#include "libs/duration_t.h"
|
|
||||||
|
|
||||||
#include "gcode/gcode.h"
|
#include "gcode/gcode.h"
|
||||||
#include "gcode/parser.h"
|
#include "gcode/parser.h"
|
||||||
|
@ -125,6 +125,7 @@
|
||||||
#include "feature/tmc2130.h"
|
#include "feature/tmc2130.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool Running = true;
|
bool Running = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,13 +167,6 @@ millis_t previous_cmd_ms = 0;
|
||||||
static millis_t max_inactive_time = 0;
|
static millis_t max_inactive_time = 0;
|
||||||
static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
|
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)
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
float z_endstop_adj;
|
float z_endstop_adj;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,12 +32,6 @@
|
||||||
#include "gcode/parser.h"
|
#include "gcode/parser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
|
||||||
#include "module/printcounter.h"
|
|
||||||
#else
|
|
||||||
#include "libs/stopwatch.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void idle(
|
void idle(
|
||||||
|
@ -234,13 +228,6 @@ extern volatile bool wait_for_heatup;
|
||||||
extern int lpq_len;
|
extern int lpq_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Print job timer
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
|
||||||
extern PrintCounter print_job_timer;
|
|
||||||
#else
|
|
||||||
extern Stopwatch print_job_timer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(MIXING_EXTRUDER)
|
#if ENABLED(MIXING_EXTRUDER)
|
||||||
extern float mixing_factor[MIXING_STEPPERS];
|
extern float mixing_factor[MIXING_STEPPERS];
|
||||||
#if MIXING_VIRTUAL_TOOLS > 1
|
#if MIXING_VIRTUAL_TOOLS > 1
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
#include "tmc2130.h"
|
#include "tmc2130.h"
|
||||||
#include "../Marlin.h"
|
#include "../Marlin.h"
|
||||||
|
|
||||||
#include "../libs/duration_t.h"
|
|
||||||
#include "../module/stepper_indirection.h"
|
#include "../module/stepper_indirection.h"
|
||||||
|
#include "../module/printcounter.h"
|
||||||
|
#include "../libs/duration_t.h"
|
||||||
|
|
||||||
#ifdef AUTOMATIC_CURRENT_CONTROL
|
#ifdef AUTOMATIC_CURRENT_CONTROL
|
||||||
bool auto_current_control = 0;
|
bool auto_current_control = 0;
|
||||||
|
|
|
@ -31,6 +31,7 @@ GcodeSuite gcode;
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "../module/motion.h"
|
#include "../module/motion.h"
|
||||||
|
#include "../module/printcounter.h"
|
||||||
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER)
|
||||||
#include "../module/printcounter.h"
|
#include "../module/printcounter.h"
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
#include "../module/stepper.h"
|
#include "../module/stepper.h"
|
||||||
#include "../module/motion.h"
|
#include "../module/motion.h"
|
||||||
#include "../module/probe.h"
|
#include "../module/probe.h"
|
||||||
|
#include "../module/printcounter.h"
|
||||||
#include "../gcode/gcode.h"
|
#include "../gcode/gcode.h"
|
||||||
#include "../gcode/queue.h"
|
#include "../gcode/queue.h"
|
||||||
#include "../module/configuration_store.h"
|
#include "../module/configuration_store.h"
|
||||||
|
|
||||||
#include "../Marlin.h"
|
#include "../Marlin.h"
|
||||||
|
|
||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER) && ENABLED(LCD_INFO_MENU)
|
||||||
#include "../module/printcounter.h"
|
|
||||||
#include "../libs/duration_t.h"
|
#include "../libs/duration_t.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dogm/dogm_bitmaps.h"
|
#include "dogm/dogm_bitmaps.h"
|
||||||
|
|
||||||
|
#if ENABLED(SDSUPPORT)
|
||||||
#include "../libs/duration_t.h"
|
#include "../libs/duration_t.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if ENABLED(PRINTCOUNTER)
|
||||||
|
|
||||||
#include "printcounter.h"
|
#include "printcounter.h"
|
||||||
|
|
||||||
#include "../Marlin.h"
|
#include "../Marlin.h"
|
||||||
|
@ -95,7 +99,6 @@ void PrintCounter::saveStats() {
|
||||||
|
|
||||||
void PrintCounter::showStats() {
|
void PrintCounter::showStats() {
|
||||||
char buffer[21];
|
char buffer[21];
|
||||||
duration_t elapsed;
|
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM(MSG_STATS);
|
SERIAL_PROTOCOLPGM(MSG_STATS);
|
||||||
|
|
||||||
|
@ -112,7 +115,7 @@ void PrintCounter::showStats() {
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
SERIAL_PROTOCOLPGM(MSG_STATS);
|
SERIAL_PROTOCOLPGM(MSG_STATS);
|
||||||
|
|
||||||
elapsed = this->data.printTime;
|
duration_t elapsed = this->data.printTime;
|
||||||
elapsed.toString(buffer);
|
elapsed.toString(buffer);
|
||||||
|
|
||||||
SERIAL_ECHOPGM("Total time: ");
|
SERIAL_ECHOPGM("Total time: ");
|
||||||
|
@ -231,5 +234,14 @@ void PrintCounter::reset() {
|
||||||
SERIAL_ECHOLNPGM("()");
|
SERIAL_ECHOLNPGM("()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
PrintCounter print_job_timer = PrintCounter();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include "../libs/stopwatch.h"
|
||||||
|
Stopwatch print_job_timer = Stopwatch();
|
||||||
|
|
||||||
|
#endif // PRINTCOUNTER
|
||||||
|
|
|
@ -175,4 +175,11 @@ class PrintCounter: public Stopwatch {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Print Job Timer
|
||||||
|
#if ENABLED(PRINTCOUNTER)
|
||||||
|
extern PrintCounter print_job_timer;
|
||||||
|
#else
|
||||||
|
extern Stopwatch print_job_timer;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // PRINTCOUNTER_H
|
#endif // PRINTCOUNTER_H
|
||||||
|
|
Reference in a new issue