diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 49745ed3b..167339ec6 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -730,7 +730,11 @@ void setup() { // Load data from EEPROM if available (or use defaults) // 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); diff --git a/Marlin/src/libs/stopwatch.h b/Marlin/src/libs/stopwatch.h index c092ee53c..4a1cdcfcf 100644 --- a/Marlin/src/libs/stopwatch.h +++ b/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 diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index ab60f391b..32e4d8321 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/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")); diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index fb4b18216..640d505c5 100644 --- a/Marlin/src/module/printcounter.h +++ b/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