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,27 +440,6 @@ bool MMU2::unload() {
return true; return true;
} }
bool MMU2::cut_filament(uint8_t slot){
if( ! WaitForMMUReady())
return false;
if( FindaDetectsFilament() ){
unload();
}
ReportingRAII rep(CommandInProgress::CutFilament);
for(;;){
logic.CutFilament(slot);
if( manage_response(false, true) )
break;
IncrementMMUFails();
}
extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL;
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
return true;
}
void FullScreenMsg(const char *pgmS, uint8_t slot){ void FullScreenMsg(const char *pgmS, uint8_t slot){
lcd_update_enable(false); lcd_update_enable(false);
lcd_clear(); lcd_clear();
@ -469,6 +448,30 @@ void FullScreenMsg(const char *pgmS, uint8_t slot){
lcd_print(slot + 1); lcd_print(slot + 1);
} }
bool MMU2::cut_filament(uint8_t slot){
if( ! WaitForMMUReady())
return false;
FullScreenMsg(_T(MSG_CUT_FILAMENT), slot);
{
if( FindaDetectsFilament() ){
unload();
}
ReportingRAII rep(CommandInProgress::CutFilament);
for(;;){
logic.CutFilament(slot);
if( manage_response(false, true) )
break;
IncrementMMUFails();
}
}
extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL;
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
return true;
}
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,16 +544,19 @@ bool MMU2::eject_filament(uint8_t slot, bool recover) {
if( ! WaitForMMUReady()) if( ! WaitForMMUReady())
return false; return false;
if( FindaDetectsFilament() ){ FullScreenMsg(_T(MSG_EJECT_FILAMENT), slot);
unload(); {
} if( FindaDetectsFilament() ){
unload();
}
ReportingRAII rep(CommandInProgress::EjectFilament); ReportingRAII rep(CommandInProgress::EjectFilament);
for(;;) { for(;;) {
logic.EjectFilament(slot); logic.EjectFilament(slot);
if( manage_response(false, true) ) if( manage_response(false, true) )
break; break;
IncrementMMUFails(); IncrementMMUFails();
}
} }
extruder = MMU2_NO_TOOL; extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL; tool_change_extruder = MMU2_NO_TOOL;

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++)