Merge pull request #1561 from PavelSindler/MK3_for_merging
preHeat @ filament management
This commit is contained in:
commit
278bf0d9bb
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
extern int32_t lcd_encoder;
|
extern int32_t lcd_encoder;
|
||||||
|
|
||||||
#define MENU_DEPTH_MAX 4
|
#define MENU_DEPTH_MAX 6
|
||||||
|
|
||||||
static menu_record_t menu_stack[MENU_DEPTH_MAX];
|
static menu_record_t menu_stack[MENU_DEPTH_MAX];
|
||||||
|
|
||||||
|
|
@ -85,7 +85,6 @@ void menu_end(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-//
|
|
||||||
void menu_back(uint8_t nLevel)
|
void menu_back(uint8_t nLevel)
|
||||||
{
|
{
|
||||||
menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0);
|
menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0);
|
||||||
|
|
@ -97,17 +96,6 @@ void menu_back(void)
|
||||||
menu_back(1);
|
menu_back(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void menu_back(void)
|
|
||||||
{
|
|
||||||
if (menu_depth > 0)
|
|
||||||
{
|
|
||||||
menu_depth--;
|
|
||||||
menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void menu_back_no_reset(void)
|
static void menu_back_no_reset(void)
|
||||||
{
|
{
|
||||||
if (menu_depth > 0)
|
if (menu_depth > 0)
|
||||||
|
|
@ -394,8 +382,3 @@ template uint8_t menu_item_edit_P<int16_t*>(const char* str, int16_t *pval, int1
|
||||||
template uint8_t menu_item_edit_P<uint8_t*>(const char* str, uint8_t *pval, int16_t min_val, int16_t max_val);
|
template uint8_t menu_item_edit_P<uint8_t*>(const char* str, uint8_t *pval, int16_t min_val, int16_t max_val);
|
||||||
|
|
||||||
#undef _menu_data
|
#undef _menu_data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1022,6 +1022,28 @@ void mmu_filament_ramming()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-//
|
||||||
|
void extr_unload_()
|
||||||
|
{
|
||||||
|
//if(bFilamentAction)
|
||||||
|
if(0)
|
||||||
|
{
|
||||||
|
bFilamentAction=false;
|
||||||
|
extr_unload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad;
|
||||||
|
bFilamentFirstRun=false;
|
||||||
|
if(target_temperature[0]>=EXTRUDE_MINTEMP)
|
||||||
|
{
|
||||||
|
bFilamentPreheatState=true;
|
||||||
|
mFilamentItem(target_temperature[0],target_temperature_bed);
|
||||||
|
}
|
||||||
|
// else menu_submenu(mFilamentMenu);
|
||||||
|
else mFilamentMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void extr_unload()
|
void extr_unload()
|
||||||
{ //unload just current filament for multimaterial printers
|
{ //unload just current filament for multimaterial printers
|
||||||
#ifdef SNMM
|
#ifdef SNMM
|
||||||
|
|
@ -1030,11 +1052,8 @@ void extr_unload()
|
||||||
uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-// if (degHotend0() > EXTRUDE_MINTEMP)
|
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||||
//if(current_temperature[0]>(target_temperature[0]*0.95))
|
|
||||||
if(bFilamentAction)
|
|
||||||
{
|
{
|
||||||
bFilamentAction=false;
|
|
||||||
#ifndef SNMM
|
#ifndef SNMM
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
|
|
@ -1108,13 +1127,7 @@ bFilamentAction=false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad;
|
show_preheat_nozzle_warning();
|
||||||
bFilamentFirstRun=false;
|
|
||||||
if(target_temperature[0]>=EXTRUDE_MINTEMP) {
|
|
||||||
bFilamentPreheatState=true;
|
|
||||||
mFilamentItem(target_temperature[0],target_temperature_bed);
|
|
||||||
}
|
|
||||||
else menu_submenu(mFilamentMenu);
|
|
||||||
}
|
}
|
||||||
//lcd_return_to_status();
|
//lcd_return_to_status();
|
||||||
}
|
}
|
||||||
|
|
@ -1172,51 +1185,71 @@ void extr_adj_4()
|
||||||
|
|
||||||
void mmu_load_to_nozzle_0()
|
void mmu_load_to_nozzle_0()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
lcd_mmu_load_to_nozzle(0);
|
lcd_mmu_load_to_nozzle(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_load_to_nozzle_1()
|
void mmu_load_to_nozzle_1()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
lcd_mmu_load_to_nozzle(1);
|
lcd_mmu_load_to_nozzle(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_load_to_nozzle_2()
|
void mmu_load_to_nozzle_2()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
lcd_mmu_load_to_nozzle(2);
|
lcd_mmu_load_to_nozzle(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_load_to_nozzle_3()
|
void mmu_load_to_nozzle_3()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
lcd_mmu_load_to_nozzle(3);
|
lcd_mmu_load_to_nozzle(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_load_to_nozzle_4()
|
void mmu_load_to_nozzle_4()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
lcd_mmu_load_to_nozzle(4);
|
lcd_mmu_load_to_nozzle(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_eject_fil_0()
|
void mmu_eject_fil_0()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
mmu_eject_filament(0, true);
|
mmu_eject_filament(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_eject_fil_1()
|
void mmu_eject_fil_1()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
mmu_eject_filament(1, true);
|
mmu_eject_filament(1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_eject_fil_2()
|
void mmu_eject_fil_2()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
mmu_eject_filament(2, true);
|
mmu_eject_filament(2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_eject_fil_3()
|
void mmu_eject_fil_3()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
mmu_eject_filament(3, true);
|
mmu_eject_filament(3, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmu_eject_fil_4()
|
void mmu_eject_fil_4()
|
||||||
{
|
{
|
||||||
|
//-//
|
||||||
|
menu_back();
|
||||||
mmu_eject_filament(4, true);
|
mmu_eject_filament(4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1344,7 +1377,7 @@ void mmu_show_warning()
|
||||||
void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
|
void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
|
||||||
{
|
{
|
||||||
//-//
|
//-//
|
||||||
bFilamentAction=false;
|
bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()"
|
||||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||||
{
|
{
|
||||||
tmp_extruder = filament_nr;
|
tmp_extruder = filament_nr;
|
||||||
|
|
@ -1377,7 +1410,8 @@ bFilamentAction=false;
|
||||||
void mmu_eject_filament(uint8_t filament, bool recover)
|
void mmu_eject_filament(uint8_t filament, bool recover)
|
||||||
{
|
{
|
||||||
//-//
|
//-//
|
||||||
bFilamentAction=false;
|
bFilamentAction=false; // NOT in "mmu_fil_eject_menu()"
|
||||||
|
return;
|
||||||
if (filament < 5)
|
if (filament < 5)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,8 @@ extern int get_ext_nr();
|
||||||
extern void display_loading();
|
extern void display_loading();
|
||||||
extern void extr_adj(int extruder);
|
extern void extr_adj(int extruder);
|
||||||
extern void extr_unload();
|
extern void extr_unload();
|
||||||
|
//-//
|
||||||
|
extern void extr_unload_();
|
||||||
extern void extr_adj_0();
|
extern void extr_adj_0();
|
||||||
extern void extr_adj_1();
|
extern void extr_adj_1();
|
||||||
extern void extr_adj_2();
|
extern void extr_adj_2();
|
||||||
|
|
|
||||||
|
|
@ -2310,6 +2310,8 @@ bool bFilamentAction=false;
|
||||||
|
|
||||||
static void mFilamentPrompt()
|
static void mFilamentPrompt()
|
||||||
{
|
{
|
||||||
|
uint8_t nLevel;
|
||||||
|
|
||||||
lcd_set_cursor(0,0);
|
lcd_set_cursor(0,0);
|
||||||
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
|
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
|
||||||
lcd_set_cursor(0,2);
|
lcd_set_cursor(0,2);
|
||||||
|
|
@ -2332,14 +2334,13 @@ switch(eFilamentAction)
|
||||||
}
|
}
|
||||||
if(lcd_clicked())
|
if(lcd_clicked())
|
||||||
{
|
{
|
||||||
//./ menu_back();
|
nLevel=2;
|
||||||
//./ menu_back();
|
|
||||||
menu_back(2);
|
|
||||||
if(!bFilamentPreheatState)
|
if(!bFilamentPreheatState)
|
||||||
{
|
{
|
||||||
menu_back();
|
nLevel++;
|
||||||
//-// setTargetHotend0(0.0);
|
// setTargetHotend0(0.0); // uncoment if return to base state is required
|
||||||
}
|
}
|
||||||
|
menu_back(nLevel);
|
||||||
switch(eFilamentAction)
|
switch(eFilamentAction)
|
||||||
{
|
{
|
||||||
case e_FILAMENT_ACTION_Load:
|
case e_FILAMENT_ACTION_Load:
|
||||||
|
|
@ -2350,20 +2351,27 @@ menu_back(2);
|
||||||
case e_FILAMENT_ACTION_unLoad:
|
case e_FILAMENT_ACTION_unLoad:
|
||||||
enquecommand_P(PSTR("M702")); // unload filament
|
enquecommand_P(PSTR("M702")); // unload filament
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
case e_FILAMENT_ACTION_mmuLoad:
|
case e_FILAMENT_ACTION_mmuLoad:
|
||||||
MYSERIAL.println("mFilamentPrompt - mmuLoad");
|
//./ MYSERIAL.println("mFilamentPrompt - mmuLoad");
|
||||||
bFilamentAction=true;
|
bFilamentAction=true;
|
||||||
menu_submenu(mmu_load_to_nozzle_menu);
|
menu_submenu(mmu_load_to_nozzle_menu);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
/*
|
||||||
case e_FILAMENT_ACTION_mmuUnLoad:
|
case e_FILAMENT_ACTION_mmuUnLoad:
|
||||||
bFilamentAction=true;
|
//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad");
|
||||||
|
bFilamentAction=true;
|
||||||
extr_unload();
|
extr_unload();
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
/*
|
||||||
case e_FILAMENT_ACTION_mmuEject:
|
case e_FILAMENT_ACTION_mmuEject:
|
||||||
MYSERIAL.println("mFilamentPrompt - mmuEject");
|
MYSERIAL.println("mFilamentPrompt - mmuEject");
|
||||||
bFilamentAction=true;
|
bFilamentAction=true;
|
||||||
menu_submenu(mmu_fil_eject_menu);
|
// menu_submenu(mmu_fil_eject_menu);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
|
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
|
||||||
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
|
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
|
||||||
|
|
@ -2373,6 +2381,8 @@ bFilamentAction=true;
|
||||||
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;
|
||||||
|
static bool bBeep=false;
|
||||||
|
|
||||||
//if(bPreheatState) // not necessary
|
//if(bPreheatState) // not necessary
|
||||||
nTargetOld=target_temperature[0];
|
nTargetOld=target_temperature[0];
|
||||||
|
|
@ -2416,12 +2426,47 @@ if(lcd_clicked())
|
||||||
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
|
if(eFilamentAction==e_FILAMENT_ACTION_autoLoad)
|
||||||
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
|
eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad
|
||||||
}
|
}
|
||||||
//./else if(!isHeatingHotend0())
|
else {
|
||||||
else if(current_temperature[0]>(target_temperature[0]*0.95))
|
if(current_temperature[0]>(target_temperature[0]*0.95))
|
||||||
{
|
{
|
||||||
menu_submenu(mFilamentPrompt);
|
switch(eFilamentAction)
|
||||||
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
|
{
|
||||||
|
case e_FILAMENT_ACTION_Load:
|
||||||
|
case e_FILAMENT_ACTION_autoLoad:
|
||||||
|
case e_FILAMENT_ACTION_unLoad:
|
||||||
|
menu_submenu(mFilamentPrompt);
|
||||||
|
break;
|
||||||
|
case e_FILAMENT_ACTION_mmuLoad:
|
||||||
|
nLevel=1;
|
||||||
|
if(!bFilamentPreheatState)
|
||||||
|
nLevel++;
|
||||||
|
bFilamentAction=true;
|
||||||
|
menu_back(nLevel);
|
||||||
|
menu_submenu(mmu_load_to_nozzle_menu);
|
||||||
|
break;
|
||||||
|
case e_FILAMENT_ACTION_mmuUnLoad:
|
||||||
|
nLevel=1;
|
||||||
|
if(!bFilamentPreheatState)
|
||||||
|
nLevel++;
|
||||||
|
bFilamentAction=true;
|
||||||
|
menu_back(nLevel);
|
||||||
|
extr_unload();
|
||||||
|
break;
|
||||||
|
case e_FILAMENT_ACTION_mmuEject:
|
||||||
|
nLevel=1;
|
||||||
|
if(!bFilamentPreheatState)
|
||||||
|
nLevel++;
|
||||||
|
bFilamentAction=true;
|
||||||
|
menu_back(nLevel);
|
||||||
|
menu_submenu(mmu_fil_eject_menu);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(bBeep)
|
||||||
|
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
|
||||||
|
bBeep=false;
|
||||||
}
|
}
|
||||||
|
else bBeep=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mFilamentItem_PLA()
|
static void mFilamentItem_PLA()
|
||||||
|
|
@ -5643,10 +5688,8 @@ static void fil_load_menu()
|
||||||
static void mmu_load_to_nozzle_menu()
|
static void mmu_load_to_nozzle_menu()
|
||||||
{
|
{
|
||||||
//-//if (degHotend0() > EXTRUDE_MINTEMP)
|
//-//if (degHotend0() > EXTRUDE_MINTEMP)
|
||||||
//if(current_temperature[0]>(target_temperature[0]*0.95))
|
|
||||||
if(bFilamentAction)
|
if(bFilamentAction)
|
||||||
{
|
{
|
||||||
//../bFilamentAction=false;
|
|
||||||
MENU_BEGIN();
|
MENU_BEGIN();
|
||||||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
||||||
MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0);
|
MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0);
|
||||||
|
|
@ -5671,10 +5714,8 @@ else {
|
||||||
static void mmu_fil_eject_menu()
|
static void mmu_fil_eject_menu()
|
||||||
{
|
{
|
||||||
//-//if (degHotend0() > EXTRUDE_MINTEMP)
|
//-//if (degHotend0() > EXTRUDE_MINTEMP)
|
||||||
//if(current_temperature[0]>(target_temperature[0]*0.95))
|
|
||||||
if(bFilamentAction)
|
if(bFilamentAction)
|
||||||
{
|
{
|
||||||
//../bFilamentAction=false;
|
|
||||||
MENU_BEGIN();
|
MENU_BEGIN();
|
||||||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
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 1"), mmu_eject_fil_0);
|
||||||
|
|
@ -5685,7 +5726,6 @@ if(bFilamentAction)
|
||||||
MENU_END();
|
MENU_END();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MYSERIAL.println(" eject - else");
|
|
||||||
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
|
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
|
||||||
bFilamentFirstRun=false;
|
bFilamentFirstRun=false;
|
||||||
if(target_temperature[0]>=EXTRUDE_MINTEMP)
|
if(target_temperature[0]>=EXTRUDE_MINTEMP)
|
||||||
|
|
@ -6166,7 +6206,8 @@ static void lcd_main_menu()
|
||||||
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("Load to nozzle"), mmu_load_to_nozzle_menu);
|
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);
|
||||||
//-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
|
//-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload);
|
//bFilamentFirstRun=true;
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_);
|
||||||
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
|
MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue