Configure / disable PRINTCOUNTER save interval (#20856)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
ConstantijnCrijnen
2021-01-26 09:30:31 +01:00
committed by GitHub
parent 8c0cb6cce8
commit b95f5c5bea
7 changed files with 50 additions and 26 deletions

View File

@@ -74,13 +74,15 @@ class PrintCounter: public Stopwatch {
*/
static constexpr millis_t updateInterval = SEC_TO_MS(10);
/**
* @brief Interval in seconds between EEPROM saves
* @details This const value defines what will be the time between each
* EEPROM save cycle, the development team recommends to set this value
* no lower than 3600 secs (1 hour).
*/
static constexpr uint16_t saveInterval = 3600;
#if PRINTCOUNTER_SAVE_INTERVAL > 0
/**
* @brief Interval in seconds between EEPROM saves
* @details This const value defines what will be the time between each
* EEPROM save cycle, the development team recommends to set this value
* no lower than 3600 secs (1 hour).
*/
static constexpr millis_t saveInterval = MIN_TO_MS(PRINTCOUNTER_SAVE_INTERVAL);
#endif
/**
* @brief Timestamp of the last call to deltaDuration()
@@ -173,7 +175,10 @@ class PrintCounter: public Stopwatch {
* The following functions are being overridden
*/
static bool start();
static bool stop();
static bool _stop(const bool completed);
static inline bool stop() { return _stop(true); }
static inline bool abort() { return _stop(false); }
static void reset();
#if HAS_SERVICE_INTERVALS