Eject filament feature in menu, M600: if it was envoked by FINDA, eject filament

This commit is contained in:
PavelSindler 2018-08-29 01:58:28 +02:00
parent b9808354c4
commit 515e78cfd1
4 changed files with 80 additions and 5 deletions

View file

@ -3120,7 +3120,20 @@ void gcode_M600(bool automatic, float x_position, float y_position, float z_shif
} }
if (mmu_enabled) if (mmu_enabled)
{
if (saved_printing) mmu_eject_filament(mmu_extruder, false); //if M600 was invoked by filament senzor (FINDA) eject filament so user can easily remove it
if (!automatic) mmu_M600_wait_and_beep();
if (saved_printing) {
lcd_clear();
lcd_set_cursor(0, 2);
lcd_puts_P(_T(MSG_PLEASE_WAIT));
mmu_command(MMU_CMD_R0);
manage_response(false, false);
}
mmu_M600_load_filament(automatic); mmu_M600_load_filament(automatic);
}
else else
M600_load_filament(); M600_load_filament();

View file

@ -22,7 +22,7 @@
#define MMU_HWRESET #define MMU_HWRESET
#define MMU_RST_PIN 76 #define MMU_RST_PIN 76
#define MMU_REQUIRED_FW_BUILDNR 81 #define MMU_REQUIRED_FW_BUILDNR 83
bool mmu_enabled = false; bool mmu_enabled = false;
@ -470,7 +470,6 @@ void mmu_M600_load_filament(bool automatic)
bool yes = false; bool yes = false;
tmp_extruder = mmu_extruder; tmp_extruder = mmu_extruder;
if (!automatic) { if (!automatic) {
mmu_M600_wait_and_beep();
#ifdef MMU_M600_SWITCH_EXTRUDER #ifdef MMU_M600_SWITCH_EXTRUDER
yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false); yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if(yes) tmp_extruder = choose_extruder_menu(); if(yes) tmp_extruder = choose_extruder_menu();
@ -790,6 +789,36 @@ void extr_adj_4()
#endif #endif
} }
void mmu_eject_fil_0()
{
mmu_eject_filament(0, true);
}
void mmu_eject_fil_1()
{
mmu_eject_filament(1, true);
}
void mmu_eject_fil_2()
{
mmu_eject_filament(2, true);
}
void mmu_eject_fil_3()
{
mmu_eject_filament(3, true);
}
void mmu_eject_fil_4()
{
mmu_eject_filament(4, true);
}
void mmu_eject_fil_5()
{
mmu_eject_filament(5, true);
}
void load_all() void load_all()
{ {
#ifndef SNMM #ifndef SNMM
@ -921,7 +950,21 @@ void mmu_show_warning()
kill(_i("Please update firmware in your MMU2. Waiting for reset.")); kill(_i("Please update firmware in your MMU2. Waiting for reset."));
} }
static void mmu_eject_filament(uint8_t filament) void mmu_eject_filament(uint8_t filament, bool recover)
{ {
if (filament < 5) mmu_command(MMU_CMD_E0 + filament); if (filament < 5)
{
mmu_command(MMU_CMD_E0 + filament);
manage_response(false, false);
if (recover)
{
lcd_show_fullscreen_message_and_wait_P(_i("Please remove filament and then press the knob."));
mmu_command(MMU_CMD_R0);
manage_response(false, false);
}
}
else
{
puts_P(PSTR("Filament nr out of range!"));
}
} }

View file

@ -91,4 +91,9 @@ extern void extr_unload_4();
extern bool mmu_check_version(); extern bool mmu_check_version();
extern void mmu_show_warning(); extern void mmu_show_warning();
extern void mmu_eject_filament(uint8_t filament, bool recover);
extern void mmu_eject_fil_0();
extern void mmu_eject_fil_1();
extern void mmu_eject_fil_2();
extern void mmu_eject_fil_3();
extern void mmu_eject_fil_4();

View file

@ -5203,6 +5203,19 @@ static void fil_load_menu()
MENU_END(); MENU_END();
} }
static void mmu_fil_eject_menu()
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0);
MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_fil_1);
MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_fil_2);
MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_fil_3);
MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_fil_4);
MENU_END();
}
static void fil_unload_menu() static void fil_unload_menu()
{ {
MENU_BEGIN(); MENU_BEGIN();
@ -5651,6 +5664,7 @@ static void lcd_main_menu()
if (mmu_enabled) if (mmu_enabled)
{ {
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu);
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
if (mmu_enabled) if (mmu_enabled)
MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C")); MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C"));
else else