From 75221fa6737cffa3e514502da0d929e64a7163c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Sun, 22 May 2016 13:14:58 +0100 Subject: [PATCH] Followup for #3813 --- Marlin/printcounter.cpp | 3 ++- Marlin/printcounter.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Marlin/printcounter.cpp b/Marlin/printcounter.cpp index 30a94f28db..3a555c2a78 100644 --- a/Marlin/printcounter.cpp +++ b/Marlin/printcounter.cpp @@ -128,7 +128,7 @@ void PrintCounter::tick() { } // Trying to get the amount of calculations down to the bare min - const static uint16_t j = this->saveInterval * 1000; + const static uint32_t j = this->saveInterval * 1000; if (now - eeprom_before >= j) { eeprom_before = now; @@ -164,6 +164,7 @@ bool PrintCounter::stop() { this->data.finishedPrints++; this->data.printTime += this->deltaDuration(); this->saveStats(); + return true; } else return false; } diff --git a/Marlin/printcounter.h b/Marlin/printcounter.h index 7e5ef31b33..dbee3f9e6d 100644 --- a/Marlin/printcounter.h +++ b/Marlin/printcounter.h @@ -55,6 +55,9 @@ class PrintCounter: public Stopwatch { * @brief Interval in seconds between counter updates * @details This const value defines what will be the time between each * accumulator update. This is different from the EEPROM save interval. + * + * @note The max value for this option is 60(s), otherwise integer + * overflow will happen. */ const uint16_t updateInterval = 10;