From 1491d682fbf25dd97a683fe6ac24bafe10c72a51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= <jbrazio@gmail.com>
Date: Thu, 28 Apr 2016 15:40:24 +0100
Subject: [PATCH] Miscellaneous tweaks on PrintCounter

---
 Marlin/Marlin_main.cpp  | 4 ++++
 Marlin/printcounter.cpp | 8 ++++----
 Marlin/printcounter.h   | 5 ++---
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 2ddb33096c..b0e576969a 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -137,6 +137,10 @@
  * M33  - Get the longname version of a path
  * M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
  * M48  - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
+ * M75  - Start the print job timer
+ * M76  - Pause the print job timer
+ * M77  - Stop the print job timer
+ * M78  - Show statistical information about the print jobs
  * M80  - Turn on Power Supply
  * M81  - Turn off Power Supply
  * M82  - Set E codes absolute (default)
diff --git a/Marlin/printcounter.cpp b/Marlin/printcounter.cpp
index c29cc8fb20..59b8bc3e3c 100644
--- a/Marlin/printcounter.cpp
+++ b/Marlin/printcounter.cpp
@@ -51,7 +51,7 @@ void PrintCounter::initStats() {
   this->data = { 0, 0, 0, 0 };
 
   this->saveStats();
-  eeprom_write_byte((uint8_t*) this->addr, 0x16);
+  eeprom_write_byte((uint8_t *) this->address, 0x16);
 }
 
 void PrintCounter::loadStats() {
@@ -60,8 +60,8 @@ void PrintCounter::loadStats() {
   #endif
 
   // Checks if the EEPROM block is initialized
-  if (eeprom_read_byte((uint8_t*) this->addr) != 0x16) this->initStats();
-  else eeprom_read_block(&this->data, (void *)(this->addr + sizeof(uint8_t)), sizeof(printStatistics));
+  if (eeprom_read_byte((uint8_t *) this->address) != 0x16) this->initStats();
+  else eeprom_read_block(&this->data, (void *)(this->address + sizeof(uint8_t)), sizeof(printStatistics));
 
   this->loaded = true;
 }
@@ -74,7 +74,7 @@ void PrintCounter::saveStats() {
   // Refuses to save data is object is not loaded
   if (!this->isLoaded()) return;
 
-  eeprom_write_block(&this->data, (void *)(this->addr + sizeof(uint8_t)), sizeof(printStatistics));
+  eeprom_update_block(&this->data, (void *)(this->address + sizeof(uint8_t)), sizeof(printStatistics));
 }
 
 void PrintCounter::showStats() {
diff --git a/Marlin/printcounter.h b/Marlin/printcounter.h
index 05f704a5be..b44caeefdd 100644
--- a/Marlin/printcounter.h
+++ b/Marlin/printcounter.h
@@ -47,13 +47,12 @@ class PrintCounter: public Stopwatch {
      * @brief EEPROM address
      * @details Defines the start offset address where the data is stored.
      */
-    const uint16_t addr = 50;
+    const uint16_t address = 0x32;
 
     /**
      * @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
-     * which is user defined at the Configuration.h file.
+     * accumulator update. This is different from the EEPROM save interval.
      */
     const uint16_t updateInterval = 10;
 
-- 
GitLab