Просмотр исходного кода

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

Bob-the-Kuhn 7 лет назад
Родитель
Сommit
025118da3e
4 измененных файлов: 16 добавлений и 7 удалений
  1. 5
    1
      Marlin/src/Marlin.cpp
  2. 5
    0
      Marlin/src/libs/stopwatch.h
  3. 0
    4
      Marlin/src/module/printcounter.cpp
  4. 6
    2
      Marlin/src/module/printcounter.h

+ 5
- 1
Marlin/src/Marlin.cpp Просмотреть файл

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

+ 5
- 0
Marlin/src/libs/stopwatch.h Просмотреть файл

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

+ 0
- 4
Marlin/src/module/printcounter.cpp Просмотреть файл

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

+ 6
- 2
Marlin/src/module/printcounter.h Просмотреть файл

99
     millis_t deltaDuration();
99
     millis_t deltaDuration();
100
 
100
 
101
   public:
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
      * @brief Checks if Print Statistics has been loaded
112
      * @brief Checks if Print Statistics has been loaded

Загрузка…
Отмена
Сохранить