Pārlūkot izejas kodu

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

Bob-the-Kuhn 7 gadus atpakaļ
vecāks
revīzija
025118da3e

+ 5
- 1
Marlin/src/Marlin.cpp Parādīt failu

@@ -730,7 +730,11 @@ void setup() {
730 730
   // Load data from EEPROM if available (or use defaults)
731 731
   // This also updates variables in the planner, elsewhere
732 732
   (void)settings.load();
733
-
733
+  
734
+  #if ENABLED(PRINTCOUNTER)
735
+    print_job_timer.init();
736
+  #endif  
737
+  
734 738
   #if HAS_M206_COMMAND
735 739
     // Initialize current position based on home_offset
736 740
     COPY(current_position, home_offset);

+ 5
- 0
Marlin/src/libs/stopwatch.h Parādīt failu

@@ -53,6 +53,11 @@ class Stopwatch {
53 53
     Stopwatch();
54 54
 
55 55
     /**
56
+     * @brief Initialize the stopwatch
57
+     */
58
+    inline void init() {}
59
+
60
+    /**
56 61
      * @brief Stops the stopwatch
57 62
      * @details Stops the running timer, it will silently ignore the request if
58 63
      * no timer is currently running.

+ 0
- 4
Marlin/src/module/printcounter.cpp Parādīt failu

@@ -28,10 +28,6 @@
28 28
 
29 29
 #include "../Marlin.h"
30 30
 
31
-PrintCounter::PrintCounter(): super() {
32
-  this->loadStats();
33
-}
34
-
35 31
 millis_t PrintCounter::deltaDuration() {
36 32
   #if ENABLED(DEBUG_PRINTCOUNTER)
37 33
     PrintCounter::debug(PSTR("deltaDuration"));

+ 6
- 2
Marlin/src/module/printcounter.h Parādīt failu

@@ -99,10 +99,14 @@ class PrintCounter: public Stopwatch {
99 99
     millis_t deltaDuration();
100 100
 
101 101
   public:
102
+
102 103
     /**
103
-     * @brief Class constructor
104
+     * @brief Initialize the print counter
104 105
      */
105
-    PrintCounter();
106
+    inline void init() {
107
+      super::init();
108
+      this->loadStats();
109
+    }
106 110
 
107 111
     /**
108 112
      * @brief Checks if Print Statistics has been loaded

Notiek ielāde…
Atcelt
Saglabāt