1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 20:18:52 +00:00

Miscellaneous tweaks on PrintCounter

This commit is contained in:
João Brázio 2016-04-28 15:40:24 +01:00
parent 27088e356f
commit 1491d682fb
No known key found for this signature in database
GPG Key ID: F62CFD37DFFDB540
3 changed files with 10 additions and 7 deletions

View File

@ -137,6 +137,10 @@
* M33 - Get the longname version of a path * 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. * 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] * 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 * M80 - Turn on Power Supply
* M81 - Turn off Power Supply * M81 - Turn off Power Supply
* M82 - Set E codes absolute (default) * M82 - Set E codes absolute (default)

View File

@ -51,7 +51,7 @@ void PrintCounter::initStats() {
this->data = { 0, 0, 0, 0 }; this->data = { 0, 0, 0, 0 };
this->saveStats(); this->saveStats();
eeprom_write_byte((uint8_t*) this->addr, 0x16); eeprom_write_byte((uint8_t *) this->address, 0x16);
} }
void PrintCounter::loadStats() { void PrintCounter::loadStats() {
@ -60,8 +60,8 @@ void PrintCounter::loadStats() {
#endif #endif
// Checks if the EEPROM block is initialized // Checks if the EEPROM block is initialized
if (eeprom_read_byte((uint8_t*) this->addr) != 0x16) this->initStats(); if (eeprom_read_byte((uint8_t *) this->address) != 0x16) this->initStats();
else eeprom_read_block(&this->data, (void *)(this->addr + sizeof(uint8_t)), sizeof(printStatistics)); else eeprom_read_block(&this->data, (void *)(this->address + sizeof(uint8_t)), sizeof(printStatistics));
this->loaded = true; this->loaded = true;
} }
@ -74,7 +74,7 @@ void PrintCounter::saveStats() {
// Refuses to save data is object is not loaded // Refuses to save data is object is not loaded
if (!this->isLoaded()) return; 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() { void PrintCounter::showStats() {

View File

@ -47,13 +47,12 @@ class PrintCounter: public Stopwatch {
* @brief EEPROM address * @brief EEPROM address
* @details Defines the start offset address where the data is stored. * @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 * @brief Interval in seconds between counter updates
* @details This const value defines what will be the time between each * @details This const value defines what will be the time between each
* accumulator update. This is different from the EEPROM save interval * accumulator update. This is different from the EEPROM save interval.
* which is user defined at the Configuration.h file.
*/ */
const uint16_t updateInterval = 10; const uint16_t updateInterval = 10;