preHeat @ filament load / unload / autoLoad / MMU

MMU options added
This commit is contained in:
MRprusa3d 2019-02-13 23:53:00 +01:00
parent a53d150903
commit ef1f82627e
4 changed files with 102 additions and 31 deletions

View File

@ -7468,7 +7468,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
#ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
if ((mcode_in_progress != 600) && (!bFilamentAutoloadFlag)) //M600 not in progress, preHeat @ autoLoad menu not active
if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active
{
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active)
{
@ -7486,9 +7486,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
}
else
{
bFilamentLoad=true; // i.e. filament loading mode
eFilamentAction=e_FILAMENT_ACTION_autoLoad;
bFilamentFirstRun=false;
bFilamentAutoloadFlag=true;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;

View File

@ -1057,7 +1057,13 @@ void extr_unload()
}
else
{
show_preheat_nozzle_warning();
eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP) {
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0]);
}
else menu_submenu(mFilamentMenu);
}
//lcd_return_to_status();
}

View File

@ -141,6 +141,9 @@ static void lcd_menu_fails_stats_mmu_print();
static void lcd_menu_fails_stats_mmu_total();
static void lcd_menu_show_sensors_state();
static void mmu_fil_eject_menu();
static void mmu_load_to_nozzle_menu();
#if defined(TMC2130) || defined(FILAMENT_SENSOR)
static void lcd_menu_fails_stats();
#endif //TMC2130 or FILAMENT_SENSOR
@ -1781,7 +1784,7 @@ void lcd_return_to_status()
lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
menu_goto(lcd_status_screen, 0, false, true);
menu_depth = 0;
bFilamentAutoloadFlag=false;
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
//! @brief Pause print, disable nozzle heater, move to park position
@ -2297,21 +2300,32 @@ void lcd_set_filament_oq_meass()
}
eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad'
bool bFilamentFirstRun;
bool bFilamentLoad;
bool bFilamentPreheatState;
bool bFilamentAutoloadFlag;
static void mFilamentPrompt()
{
lcd_set_cursor(0,0);
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
lcd_set_cursor(0,2);
lcd_puts_P(_i("Press the knob"));
lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1
lcd_set_cursor(0,3);
if(bFilamentLoad)
lcd_puts_P(_i("to load filament"));
else lcd_puts_P(_i("to unload filament"));
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
case e_FILAMENT_ACTION_mmuLoad:
lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_unLoad:
case e_FILAMENT_ACTION_mmuUnLoad:
lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_mmuEject:
lcd_puts_P(_i("to eject filament")); ////MSG_ c=20 r=1
break;
}
if(lcd_clicked())
{
menu_back();
@ -2321,15 +2335,29 @@ if(lcd_clicked())
menu_back();
setTargetHotend0(0.0);
}
if(bFilamentLoad)
switch(eFilamentAction)
{
loading_flag = true;
enquecommand_P(PSTR("M701")); // load filament
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
loading_flag = true;
enquecommand_P(PSTR("M701")); // load filament
break;
case e_FILAMENT_ACTION_unLoad:
enquecommand_P(PSTR("M702")); // unload filament
break;
case e_FILAMENT_ACTION_mmuLoad:
menu_submenu(mmu_load_to_nozzle_menu);
break;
case e_FILAMENT_ACTION_mmuUnLoad:
extr_unload();
break;
case e_FILAMENT_ACTION_mmuEject:
menu_submenu(mmu_fil_eject_menu);
break;
}
else enquecommand_P(PSTR("M702")); // unload filament
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
if(bFilamentLoad) // i.e. not necessary for preHeat @ unload
bFilamentAutoloadFlag=false;
}
void mFilamentItem(uint16_t nTemp)
@ -2343,11 +2371,23 @@ lcd_timeoutToStatus.stop();
lcd_set_cursor(0,0);
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
lcd_set_cursor(0,1);
if(bFilamentLoad)
lcd_puts_P(_i("Preheating to load"));
else lcd_puts_P(_i("Preheating to unload"));
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
case e_FILAMENT_ACTION_mmuLoad:
lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_unLoad:
case e_FILAMENT_ACTION_mmuUnLoad:
lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1
break;
case e_FILAMENT_ACTION_mmuEject:
lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1
break;
}
lcd_set_cursor(0,3);
lcd_puts_P(_i(">Cancel"));
lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1
if(lcd_clicked())
{
if(!bFilamentPreheatState)
@ -2357,8 +2397,8 @@ if(lcd_clicked())
}
else setTargetHotend0((float)nTargetOld);
menu_back();
if(bFilamentLoad) // i.e. not necessary for preHeat @ unload
bFilamentAutoloadFlag=false;
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
else if(!isHeatingHotend0())
{
@ -2407,8 +2447,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP);
void mFilamentBack()
{
menu_back();
if(bFilamentLoad) // i.e. not necessary for preHeat @ unload
bFilamentAutoloadFlag=false;
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
void mFilamentMenu()
@ -2433,7 +2473,7 @@ if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun)
enquecommand_P(PSTR("M702")); // unload filament
}
else {
bFilamentLoad=false; // i.e. filament unloading mode
eFilamentAction=e_FILAMENT_ACTION_unLoad;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
@ -2666,7 +2706,7 @@ static void lcd_LoadFilament()
}
else
{
bFilamentLoad=true; // i.e. filament loading mode
eFilamentAction=e_FILAMENT_ACTION_Load;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
@ -5578,6 +5618,8 @@ static void fil_load_menu()
}
static void mmu_load_to_nozzle_menu()
{
if (degHotend0() > EXTRUDE_MINTEMP)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
@ -5588,8 +5630,21 @@ static void mmu_load_to_nozzle_menu()
MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4);
MENU_END();
}
else {
eFilamentAction=e_FILAMENT_ACTION_mmuLoad;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0]);
}
else mFilamentMenu();
}
}
static void mmu_fil_eject_menu()
{
if (degHotend0() > EXTRUDE_MINTEMP)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
@ -5598,9 +5653,19 @@ static void mmu_fil_eject_menu()
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();
}
else {
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0]);
}
else mFilamentMenu();
}
}
#ifdef SNMM
static void fil_unload_menu()
@ -6071,7 +6136,7 @@ static void lcd_main_menu()
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu);
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C"));
MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
}
else
{

View File

@ -133,10 +133,11 @@ void extr_unload_used();
#endif //SNMM
void extr_unload();
typedef enum
{e_FILAMENT_ACTION_none,e_FILAMENT_ACTION_Load,e_FILAMENT_ACTION_autoLoad,e_FILAMENT_ACTION_unLoad,e_FILAMENT_ACTION_mmuLoad,e_FILAMENT_ACTION_mmuUnLoad,e_FILAMENT_ACTION_mmuEject} eFILAMENT_ACTION; // 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
extern eFILAMENT_ACTION eFilamentAction;
extern bool bFilamentFirstRun;
extern bool bFilamentLoad;
extern bool bFilamentPreheatState;
extern bool bFilamentAutoloadFlag;
void mFilamentItem(uint16_t nTemp);
void mFilamentMenu();
void unload_filament();