Merge pull request #1568 from MRprusa3d/PFW-795

preHeat @ filament management
This commit is contained in:
PavelSindler 2019-02-27 13:15:39 +01:00 committed by GitHub
commit ff6eb0b1af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 7 deletions

View File

@ -7482,6 +7482,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false) if (mmu_enabled == false)
{ {
//-// if (mcode_in_progress != 600) //M600 not in progress
if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //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) if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active)
@ -7491,7 +7492,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
#ifdef PAT9125 #ifdef PAT9125
fsensor_autoload_check_stop(); fsensor_autoload_check_stop();
#endif //PAT9125 #endif //PAT9125
if (degHotend0() > EXTRUDE_MINTEMP) //-// if (degHotend0() > EXTRUDE_MINTEMP)
if(0)
{ {
if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE))
_tone(BEEPER, 1000); _tone(BEEPER, 1000);
@ -7502,12 +7504,18 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
} }
else else
{ {
/*
lcd_update_enable(false);
show_preheat_nozzle_warning();
lcd_update_enable(true);
*/
eFilamentAction=e_FILAMENT_ACTION_autoLoad; eFilamentAction=e_FILAMENT_ACTION_autoLoad;
bFilamentFirstRun=false; bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP) if(target_temperature[0]>=EXTRUDE_MINTEMP)
{ {
bFilamentPreheatState=true; bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed); // mFilamentItem(target_temperature[0],target_temperature_bed);
menu_submenu(mFilamentItemForce);
} }
else else
{ {

View File

@ -1044,6 +1044,16 @@ else {
} }
} }
//-//
void extr_unload_view()
{
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
lcd_print(" ");
if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" ");
else lcd_print(mmu_extruder + 1);
}
void extr_unload() void extr_unload()
{ //unload just current filament for multimaterial printers { //unload just current filament for multimaterial printers
#ifdef SNMM #ifdef SNMM
@ -1058,12 +1068,15 @@ void extr_unload()
st_synchronize(); st_synchronize();
//show which filament is currently unloaded //show which filament is currently unloaded
lcd_update_enable(false); //-// lcd_update_enable(false);
menu_submenu(extr_unload_view);
/*
lcd_clear(); lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT));
lcd_print(" "); lcd_print(" ");
if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" ");
else lcd_print(mmu_extruder + 1); else lcd_print(mmu_extruder + 1);
*/
mmu_filament_ramming(); mmu_filament_ramming();
@ -1071,7 +1084,8 @@ void extr_unload()
// get response // get response
manage_response(false, true, MMU_UNLOAD_MOVE); manage_response(false, true, MMU_UNLOAD_MOVE);
lcd_update_enable(true); //-// lcd_update_enable(true);
menu_back();
#else //SNMM #else //SNMM
lcd_clear(); lcd_clear();

View File

@ -2307,6 +2307,7 @@ eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized
bool bFilamentFirstRun; bool bFilamentFirstRun;
bool bFilamentPreheatState; bool bFilamentPreheatState;
bool bFilamentAction=false; bool bFilamentAction=false;
bool bFilamentWaitingFlag=false;
static void mFilamentPrompt() static void mFilamentPrompt()
{ {
@ -2338,14 +2339,14 @@ if(lcd_clicked())
if(!bFilamentPreheatState) if(!bFilamentPreheatState)
{ {
nLevel++; nLevel++;
// setTargetHotend0(0.0); // uncoment if return to base state is required // setTargetHotend0(0.0); // uncoment if return to base-state is required
} }
menu_back(nLevel); menu_back(nLevel);
switch(eFilamentAction) switch(eFilamentAction)
{ {
case e_FILAMENT_ACTION_Load: case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad: case e_FILAMENT_ACTION_autoLoad:
loading_flag = true; loading_flag=true;
enquecommand_P(PSTR("M701")); // load filament enquecommand_P(PSTR("M701")); // load filament
break; break;
case e_FILAMENT_ACTION_unLoad: case e_FILAMENT_ACTION_unLoad:
@ -2378,7 +2379,8 @@ if(lcd_clicked())
} }
} }
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) /*
void _mFilamentItem(uint16_t nTemp,uint16_t nTempBed)
{ {
static int nTargetOld,nTargetBedOld; static int nTargetOld,nTargetBedOld;
uint8_t nLevel; uint8_t nLevel;
@ -2468,6 +2470,106 @@ else {
else bBeep=true; else bBeep=true;
} }
} }
*/
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed)
{
static int nTargetOld,nTargetBedOld;
uint8_t nLevel;
//if(bPreheatState) // not necessary
nTargetOld=target_temperature[0];
nTargetBedOld=target_temperature_bed;
setTargetHotend0((float)nTemp);
setTargetBed((float)nTempBed);
lcd_timeoutToStatus.stop();
if(current_temperature[0]>(target_temperature[0]*0.95))
{
switch(eFilamentAction)
{
case e_FILAMENT_ACTION_Load:
case e_FILAMENT_ACTION_autoLoad:
case e_FILAMENT_ACTION_unLoad:
if(bFilamentWaitingFlag)
menu_submenu(mFilamentPrompt);
else {
nLevel=bFilamentPreheatState?1:2;
menu_back(nLevel);
if((eFilamentAction==e_FILAMENT_ACTION_Load)||(eFilamentAction==e_FILAMENT_ACTION_autoLoad))
{
loading_flag=true;
enquecommand_P(PSTR("M701")); // load filament
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
if(eFilamentAction==e_FILAMENT_ACTION_unLoad)
enquecommand_P(PSTR("M702")); // unload filament
}
break;
case e_FILAMENT_ACTION_mmuLoad:
nLevel=bFilamentPreheatState?1:2;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_load_to_nozzle_menu);
break;
case e_FILAMENT_ACTION_mmuUnLoad:
nLevel=bFilamentPreheatState?1:2;
bFilamentAction=true;
menu_back(nLevel);
extr_unload();
break;
case e_FILAMENT_ACTION_mmuEject:
nLevel=bFilamentPreheatState?1:2;
bFilamentAction=true;
menu_back(nLevel);
menu_submenu(mmu_fil_eject_menu);
break;
}
if(bFilamentWaitingFlag)
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
bFilamentWaitingFlag=false;
}
else {
bFilamentWaitingFlag=true;
lcd_set_cursor(0,0);
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
lcd_set_cursor(0,1);
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")); ////MSG_ c=20 r=1
if(lcd_clicked())
{
bFilamentWaitingFlag=false;
if(!bFilamentPreheatState)
{
setTargetHotend0(0.0);
setTargetBed(0.0);
menu_back();
}
else {
setTargetHotend0((float)nTargetOld);
setTargetBed((float)nTargetBedOld);
}
menu_back();
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
}
}
}
static void mFilamentItem_PLA() static void mFilamentItem_PLA()
{ {
@ -2526,6 +2628,11 @@ MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRI
MENU_END(); MENU_END();
} }
void mFilamentItemForce()
{
mFilamentItem(target_temperature[0],target_temperature_bed);
}
void lcd_unLoadFilament() void lcd_unLoadFilament()
{ {

View File

@ -140,6 +140,7 @@ extern bool bFilamentFirstRun;
extern bool bFilamentPreheatState; extern bool bFilamentPreheatState;
extern bool bFilamentAction; extern bool bFilamentAction;
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
void mFilamentItemForce();
void mFilamentMenu(); void mFilamentMenu();
void unload_filament(); void unload_filament();