Browse Source

Miscellaneous tweaks on PrintCounter

João Brázio 8 years ago
parent
commit
1491d682fb
No account linked to committer's email address
3 changed files with 10 additions and 7 deletions
  1. 4
    0
      Marlin/Marlin_main.cpp
  2. 4
    4
      Marlin/printcounter.cpp
  3. 2
    3
      Marlin/printcounter.h

+ 4
- 0
Marlin/Marlin_main.cpp View File

137
  * M33  - Get the longname version of a path
137
  * M33  - Get the longname version of a path
138
  * 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.
138
  * 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.
139
  * M48  - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
139
  * M48  - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
140
+ * M75  - Start the print job timer
141
+ * M76  - Pause the print job timer
142
+ * M77  - Stop the print job timer
143
+ * M78  - Show statistical information about the print jobs
140
  * M80  - Turn on Power Supply
144
  * M80  - Turn on Power Supply
141
  * M81  - Turn off Power Supply
145
  * M81  - Turn off Power Supply
142
  * M82  - Set E codes absolute (default)
146
  * M82  - Set E codes absolute (default)

+ 4
- 4
Marlin/printcounter.cpp View File

51
   this->data = { 0, 0, 0, 0 };
51
   this->data = { 0, 0, 0, 0 };
52
 
52
 
53
   this->saveStats();
53
   this->saveStats();
54
-  eeprom_write_byte((uint8_t*) this->addr, 0x16);
54
+  eeprom_write_byte((uint8_t *) this->address, 0x16);
55
 }
55
 }
56
 
56
 
57
 void PrintCounter::loadStats() {
57
 void PrintCounter::loadStats() {
60
   #endif
60
   #endif
61
 
61
 
62
   // Checks if the EEPROM block is initialized
62
   // Checks if the EEPROM block is initialized
63
-  if (eeprom_read_byte((uint8_t*) this->addr) != 0x16) this->initStats();
64
-  else eeprom_read_block(&this->data, (void *)(this->addr + sizeof(uint8_t)), sizeof(printStatistics));
63
+  if (eeprom_read_byte((uint8_t *) this->address) != 0x16) this->initStats();
64
+  else eeprom_read_block(&this->data, (void *)(this->address + sizeof(uint8_t)), sizeof(printStatistics));
65
 
65
 
66
   this->loaded = true;
66
   this->loaded = true;
67
 }
67
 }
74
   // Refuses to save data is object is not loaded
74
   // Refuses to save data is object is not loaded
75
   if (!this->isLoaded()) return;
75
   if (!this->isLoaded()) return;
76
 
76
 
77
-  eeprom_write_block(&this->data, (void *)(this->addr + sizeof(uint8_t)), sizeof(printStatistics));
77
+  eeprom_update_block(&this->data, (void *)(this->address + sizeof(uint8_t)), sizeof(printStatistics));
78
 }
78
 }
79
 
79
 
80
 void PrintCounter::showStats() {
80
 void PrintCounter::showStats() {

+ 2
- 3
Marlin/printcounter.h View File

47
      * @brief EEPROM address
47
      * @brief EEPROM address
48
      * @details Defines the start offset address where the data is stored.
48
      * @details Defines the start offset address where the data is stored.
49
      */
49
      */
50
-    const uint16_t addr = 50;
50
+    const uint16_t address = 0x32;
51
 
51
 
52
     /**
52
     /**
53
      * @brief Interval in seconds between counter updates
53
      * @brief Interval in seconds between counter updates
54
      * @details This const value defines what will be the time between each
54
      * @details This const value defines what will be the time between each
55
-     * accumulator update. This is different from the EEPROM save interval
56
-     * which is user defined at the Configuration.h file.
55
+     * accumulator update. This is different from the EEPROM save interval.
57
      */
56
      */
58
     const uint16_t updateInterval = 10;
57
     const uint16_t updateInterval = 10;
59
 
58
 

Loading…
Cancel
Save