Automatic recovery typo fix

Failures statistics in eeprom
This commit is contained in:
michalprusa 2017-09-26 14:14:17 +01:00
parent 5ff28682be
commit c3585bc696
3 changed files with 81 additions and 7 deletions

View file

@ -64,6 +64,12 @@
#define EEPROM_CRASH_DET (EEPROM_UVLO_MESH_BED_LEVELING-12)
// Filament sensor on/off EEPROM setting
#define EEPROM_FSENSOR (EEPROM_UVLO_MESH_BED_LEVELING-14)
// Crash detection counter
#define EEPROM_CRASH_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament runout/error coutner
#define EEPROM_FERROR_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-16)
// Power loss errors
#define EEPROM_POWER_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-17)
// Currently running firmware, each digit stored as uint16_t.
// The flavor differentiates a dev, alpha, beta, release candidate or a release version.

View file

@ -712,6 +712,12 @@ void fsensor_update()
{
MYSERIAL.println("fsensor_update - ERROR!!!");
fsensor_stop_and_save_print();
// Increment filament failure counter
uint8_t ferror_count = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
ferror_count++;
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, ferror_count);
enquecommand_front_P((PSTR("M600")));
fsensor_M600 = true;
fsensor_enabled = false;
@ -5830,6 +5836,11 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
case 10: // D10 - Tell the printer that XYZ calibration went OK
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
break;
case 12: //D12 - Reset Filament error, Power loss and crash counter ( Do it before every print and you can get stats for the print )
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT, 0x00);
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, 0x00);
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, 0x00);
case 999:
{
MYSERIAL.println("D999 - crash");
@ -5844,6 +5855,12 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
lcd_update_enable(true);
lcd_implementation_clear();
lcd_update(2);
// Increment crash counter
uint8_t crash_count = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT);
crash_count++;
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT, crash_count);
#ifdef AUTOMATIC_RECOVERY_AFTER_CRASH
bool yesno = true;
#else
@ -7072,6 +7089,11 @@ void uvlo_()
#endif
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);
SERIAL_ECHOLNPGM("UVLO - end");
cli();
while(1);

View file

@ -189,6 +189,8 @@ static void prusa_stat_temperatures();
static void prusa_stat_printinfo();
static void lcd_farm_no();
static void lcd_menu_extruder_info();
static void lcd_menu_fails_stats();
#ifdef DOGLCD
static void lcd_set_contrast();
#endif
@ -961,6 +963,47 @@ static void lcd_menu_extruder_info()
}
}
static void lcd_menu_fails_stats()
{
// Display screen info
lcd.setCursor(0, 0);
lcd.print("Failure stats ");
// Display power failures
uint8_t power_count = eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT);
lcd.setCursor(0, 1);
lcd.print(" Power failures: ");
lcd.setCursor(17, 1);
lcd.print(itostr3((int)power_count));
// Display Crash detected
uint8_t crash_count = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT);
lcd.setCursor(0, 2);
lcd.print(" Crash detected: ");
lcd.setCursor(17, 2);
lcd.print(itostr3((int)crash_count));
// Display filament failures
uint8_t ferror_count = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
lcd.setCursor(0, 3);
lcd.print(" Filament fails: ");
lcd.setCursor(17, 3);
lcd.print(itostr3((int)ferror_count));
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
}
}
static void lcd_menu_temperatures()
{
lcd.setCursor(1, 1);
@ -1066,6 +1109,9 @@ static void lcd_support_menu()
MENU_ITEM(function, PSTR("XYZ cal. details"), lcd_service_mode_show_result);
}
MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info);
MENU_ITEM(submenu, PSTR("Fail stats"), lcd_menu_fails_stats);
MENU_ITEM(submenu, PSTR("Temperatures"), lcd_menu_temperatures);
if (fans_check_enabled == true) {
MENU_ITEM(function, PSTR("Check fans [EN]"), lcd_set_fan_check);
@ -1077,7 +1123,7 @@ static void lcd_support_menu()
#ifdef AUTOMATIC_RECOVERY_AFTER_CRASH
MENU_ITEM(back, PSTR("Auto recover crash"), lcd_main_menu);
#else
#endif
END_MENU();
}