Merge pull request #1533 from MRprusa3d/PFW-210

preHeat @ filament load / unload / autoLoad / MMU
This commit is contained in:
PavelSindler 2019-02-15 17:45:38 +01:00 committed by GitHub
commit 11d19879fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 33 deletions

View File

@ -7482,7 +7482,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)
{
@ -7502,9 +7502,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

@ -1105,7 +1105,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

@ -142,6 +142,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
@ -1784,7 +1787,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
@ -2300,21 +2303,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();
@ -2322,17 +2336,31 @@ if(lcd_clicked())
if(!bFilamentPreheatState)
{
menu_back();
setTargetHotend0(0.0);
//-// 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)
@ -2346,11 +2374,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)
@ -2360,8 +2400,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())
{
@ -2410,8 +2450,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()
@ -2436,7 +2476,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)
{
@ -2670,7 +2710,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)
{
@ -5585,6 +5625,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));
@ -5595,8 +5637,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));
@ -5605,9 +5660,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()
@ -6077,8 +6142,8 @@ 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_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C"));
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
}
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();