Cut & Eject: avoid preheat if no filament loaded

and add fullscreen messages for Cut & Eject (messages intentionally reused to save space)
This commit is contained in:
D.R.racer 2022-12-29 20:48:10 +01:00 committed by DRracer
parent 43f3865d7c
commit 52a3beb931
2 changed files with 38 additions and 32 deletions

View File

@ -440,10 +440,20 @@ bool MMU2::unload() {
return true; return true;
} }
void FullScreenMsg(const char *pgmS, uint8_t slot){
lcd_update_enable(false);
lcd_clear();
lcd_puts_at_P(0, 1, pgmS);
lcd_print(' ');
lcd_print(slot + 1);
}
bool MMU2::cut_filament(uint8_t slot){ bool MMU2::cut_filament(uint8_t slot){
if( ! WaitForMMUReady()) if( ! WaitForMMUReady())
return false; return false;
FullScreenMsg(_T(MSG_CUT_FILAMENT), slot);
{
if( FindaDetectsFilament() ){ if( FindaDetectsFilament() ){
unload(); unload();
} }
@ -455,20 +465,13 @@ bool MMU2::cut_filament(uint8_t slot){
break; break;
IncrementMMUFails(); IncrementMMUFails();
} }
}
extruder = MMU2_NO_TOOL; extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL; tool_change_extruder = MMU2_NO_TOOL;
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm); Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
return true; return true;
} }
void FullScreenMsg(const char *pgmS, uint8_t slot){
lcd_update_enable(false);
lcd_clear();
lcd_puts_at_P(0, 1, pgmS);
lcd_print(' ');
lcd_print(slot + 1);
}
bool MMU2::loading_test(uint8_t slot){ bool MMU2::loading_test(uint8_t slot){
FullScreenMsg(_T(MSG_TESTING_FILAMENT), slot); FullScreenMsg(_T(MSG_TESTING_FILAMENT), slot);
tool_change(slot); tool_change(slot);
@ -541,6 +544,8 @@ bool MMU2::eject_filament(uint8_t slot, bool recover) {
if( ! WaitForMMUReady()) if( ! WaitForMMUReady())
return false; return false;
FullScreenMsg(_T(MSG_EJECT_FILAMENT), slot);
{
if( FindaDetectsFilament() ){ if( FindaDetectsFilament() ){
unload(); unload();
} }
@ -552,6 +557,7 @@ bool MMU2::eject_filament(uint8_t slot, bool recover) {
break; break;
IncrementMMUFails(); IncrementMMUFails();
} }
}
extruder = MMU2_NO_TOOL; extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL; tool_change_extruder = MMU2_NO_TOOL;
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm); Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);

View File

@ -5071,7 +5071,7 @@ static void mmu_eject_filament(uint8_t filament) {
} }
static void mmu_fil_eject_menu() { static void mmu_fil_eject_menu() {
if (bFilamentAction) { if (bFilamentAction || (!MMU2::mmu2.FindaDetectsFilament())) {
MENU_BEGIN(); MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_BACK_P(_T(MSG_MAIN));
for (uint8_t i = 0; i < MMU_FILAMENT_COUNT; i++) for (uint8_t i = 0; i < MMU_FILAMENT_COUNT; i++)
@ -5089,7 +5089,7 @@ static inline void mmu_cut_filament_wrapper(uint8_t index){
} }
static void mmu_cut_filament_menu() { static void mmu_cut_filament_menu() {
if (bFilamentAction) { if (bFilamentAction || (!MMU2::mmu2.FindaDetectsFilament())) {
MENU_BEGIN(); MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_BACK_P(_T(MSG_MAIN));
for (uint8_t i = 0; i < MMU_FILAMENT_COUNT; i++) for (uint8_t i = 0; i < MMU_FILAMENT_COUNT; i++)