Merge pull request #524 from mkbel/Add_fail_stats

Add fail statistics menu item for MK25.
This commit is contained in:
PavelSindler 2018-03-06 11:55:22 +01:00 committed by GitHub
commit 54749cbcba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 10 deletions

View file

@ -168,7 +168,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
#define PAT9125
#define PAT9125 //!< Filament sensor
#define FANCHECK

View file

@ -681,6 +681,7 @@ void crashdet_cancel()
card.closefile();
tmc2130_sg_stop_on_crash = true;
}
#endif //TMC2130
void failstats_reset_print()
{
@ -690,7 +691,6 @@ void failstats_reset_print()
eeprom_update_byte((uint8_t *)EEPROM_POWER_COUNT, 0);
}
#endif //TMC2130
#ifdef MESH_BED_LEVELING
@ -4081,10 +4081,8 @@ void process_commands()
card.openFile(strchr_pointer + 4,true);
break;
case 24: //M24 - Start SD print
#ifdef TMC2130
if (!card.paused)
failstats_reset_print();
#endif //TMC2130
card.startFileprint();
starttime=millis();
break;

View file

@ -204,9 +204,9 @@ static void prusa_stat_temperatures();
static void prusa_stat_printinfo();
static void lcd_farm_no();
static void lcd_menu_extruder_info();
#ifdef TMC2130
#if defined(TMC2130) || defined(PAT9125)
static void lcd_menu_fails_stats();
#endif //TMC2130
#endif //TMC2130 or PAT9125
void lcd_finishstatus();
@ -1537,7 +1537,7 @@ static void lcd_menu_extruder_info()
}
}
#ifdef TMC2130
#if defined(TMC2130) && defined(PAT9125)
static void lcd_menu_fails_stats_total()
{
//01234567890123456789
@ -1579,7 +1579,13 @@ static void lcd_menu_fails_stats_print()
lcd_goto_menu(lcd_menu_fails_stats, 2);
}
}
/**
* @brief Open fail statistics menu
*
* This version of function is used, when there is filament sensor,
* power failure and crash detection.
* There are Last print and Total menu items.
*/
static void lcd_menu_fails_stats()
{
START_MENU();
@ -1588,6 +1594,34 @@ static void lcd_menu_fails_stats()
MENU_ITEM(submenu, PSTR("Total"), lcd_menu_fails_stats_total);
END_MENU();
}
#else if defined(PAT9125)
/**
* @brief Print last print and total filament run outs
*
* This version of function is used, when there is filament sensor,
* but no other sensors (e.g. power failure, crash detection).
*
* Example screen:
* @code
* 01234567890123456789
* Last print failures
* Filam. runouts 0
* Total failures
* Filam. runouts 5
* @endcode
*/
static void lcd_menu_fails_stats()
{
uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
fprintf_P(lcdout, PSTR(ESC_H(0,0)"Last print failures"ESC_H(1,1)"Filam. runouts %-3d"ESC_H(0,2)"Total failures"ESC_H(1,3)"Filam. runouts %-3d"), filamentLast, filamentTotal);
if (lcd_clicked())
{
lcd_quick_feedback();
//lcd_return_to_status();
lcd_goto_menu(lcd_main_menu, 8); //TODO: Remove hard coded encoder value.
}
}
#endif //TMC2130
@ -5223,9 +5257,9 @@ static void lcd_main_menu()
MENU_ITEM(submenu, MSG_STATISTICS, lcd_menu_statistics);
}
#ifdef TMC2130
#if defined(TMC2130) || defined(PAT9125)
MENU_ITEM(submenu, PSTR("Fail stats"), lcd_menu_fails_stats);
#endif //TMC2130
#endif
MENU_ITEM(submenu, MSG_SUPPORT, lcd_support_menu);