PrintCounter EEPROM read/write optimizations
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
//#define DEBUG_PRINTCOUNTER
|
||||
|
||||
struct printStatistics { // 13 bytes
|
||||
//uint8_t magic; // Magic header, it will always be 0x16
|
||||
//const uint8_t magic; // Magic header, it will always be 0x16
|
||||
uint16_t totalPrints; // Number of prints
|
||||
uint16_t finishedPrints; // Number of complete prints
|
||||
uint32_t printTime; // Total printing time
|
||||
@@ -43,14 +43,6 @@ class PrintCounter: public Stopwatch {
|
||||
|
||||
printStatistics data;
|
||||
|
||||
/**
|
||||
* @brief Timestamp of the last update
|
||||
* @details Stores the timestamp of the last data.pritnTime update, when the
|
||||
* print job finishes, this will be used to calculate the exact time elapsed,
|
||||
* this is required due to the updateInterval cycle.
|
||||
*/
|
||||
uint16_t lastUpdate;
|
||||
|
||||
/**
|
||||
* @brief EEPROM address
|
||||
* @details Defines the start offset address where the data is stored.
|
||||
@@ -73,6 +65,13 @@ class PrintCounter: public Stopwatch {
|
||||
*/
|
||||
const uint16_t saveInterval = 3600;
|
||||
|
||||
/**
|
||||
* @brief Timestamp of the last call to deltaDuration()
|
||||
* @details Stores the timestamp of the last deltaDuration(), this is
|
||||
* required due to the updateInterval cycle.
|
||||
*/
|
||||
uint16_t lastDuration;
|
||||
|
||||
/**
|
||||
* @brief Stats were loaded from EERPROM
|
||||
* @details If set to true it indicates if the statistical data was already
|
||||
@@ -80,6 +79,15 @@ class PrintCounter: public Stopwatch {
|
||||
*/
|
||||
bool loaded = false;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief dT since the last call
|
||||
* @details Returns the elapsed time in seconds since the last call, this is
|
||||
* used internally for print statistics accounting is not intended to be a
|
||||
* user callable function.
|
||||
*/
|
||||
uint16_t deltaDuration();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Class constructor
|
||||
|
Reference in New Issue
Block a user