Browse Source

Init print_job_timer in setup() instead of "early" (#9937)

pull/1/head
Bob-the-Kuhn 7 years ago
committed by Scott Lahteine
parent
commit
025118da3e
  1. 4
      Marlin/src/Marlin.cpp
  2. 5
      Marlin/src/libs/stopwatch.h
  3. 4
      Marlin/src/module/printcounter.cpp
  4. 8
      Marlin/src/module/printcounter.h

4
Marlin/src/Marlin.cpp

@ -731,6 +731,10 @@ void setup() {
// This also updates variables in the planner, elsewhere
(void)settings.load();
#if ENABLED(PRINTCOUNTER)
print_job_timer.init();
#endif
#if HAS_M206_COMMAND
// Initialize current position based on home_offset
COPY(current_position, home_offset);

5
Marlin/src/libs/stopwatch.h

@ -52,6 +52,11 @@ class Stopwatch {
*/
Stopwatch();
/**
* @brief Initialize the stopwatch
*/
inline void init() {}
/**
* @brief Stops the stopwatch
* @details Stops the running timer, it will silently ignore the request if

4
Marlin/src/module/printcounter.cpp

@ -28,10 +28,6 @@
#include "../Marlin.h"
PrintCounter::PrintCounter(): super() {
this->loadStats();
}
millis_t PrintCounter::deltaDuration() {
#if ENABLED(DEBUG_PRINTCOUNTER)
PrintCounter::debug(PSTR("deltaDuration"));

8
Marlin/src/module/printcounter.h

@ -99,10 +99,14 @@ class PrintCounter: public Stopwatch {
millis_t deltaDuration();
public:
/**
* @brief Class constructor
* @brief Initialize the print counter
*/
PrintCounter();
inline void init() {
super::init();
this->loadStats();
}
/**
* @brief Checks if Print Statistics has been loaded

Loading…
Cancel
Save