From daaac2fb8849a2cd127afdbf488eda8a3f10f2e6 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 30 Jan 2018 19:49:40 +0100 Subject: [PATCH] fail stats --- Firmware/Marlin_main.cpp | 19 ++++++++++--------- Firmware/fsensor.cpp | 5 ++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68ee96a2..2e3dc82a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1103,12 +1103,14 @@ void setup() // Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false), // but this times out if a blocking dialog is shown in setup(). card.initsd(); - if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) - eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) - eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) - eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_POWER_COUNT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_X, 0); + if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_Y, 0); + if (eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_FERROR_COUNT, 0); #ifdef SNMM if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM int _z = BOWDEN_LENGTH; @@ -7562,9 +7564,8 @@ void uvlo_() disable_z(); // Increment power failure counter - uint8_t power_count = eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT); - power_count++; - eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, power_count); + eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); + eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1); SERIAL_ECHOLNPGM("UVLO - end"); MYSERIAL.println(millis() - time_start); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index 2b53b710..c69e5d16 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -266,9 +266,8 @@ void fsensor_update() else*/ { fsensor_stop_and_save_print(); - uint8_t ferror_count = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); - ferror_count++; - eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, ferror_count); + eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); + eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); enquecommand_front_P((PSTR("M600"))); fsensor_M600 = true; fsensor_enabled = false;