Convert functions mmu_eject_fil_0 to mmu_eject_fil_4 to template function.

This commit is contained in:
Marek Bel 2019-02-26 11:11:05 +01:00
parent 34e2495487
commit 7a1b47c340
3 changed files with 30 additions and 64 deletions

View File

@ -1183,42 +1183,6 @@ void extr_adj_4()
#endif
}
void mmu_eject_fil_0()
{
//-//
menu_back();
mmu_eject_filament(0, true);
}
void mmu_eject_fil_1()
{
//-//
menu_back();
mmu_eject_filament(1, true);
}
void mmu_eject_fil_2()
{
//-//
menu_back();
mmu_eject_filament(2, true);
}
void mmu_eject_fil_3()
{
//-//
menu_back();
mmu_eject_filament(3, true);
}
void mmu_eject_fil_4()
{
//-//
menu_back();
mmu_eject_filament(4, true);
}
void load_all()
{
#ifndef SNMM

View File

@ -127,11 +127,6 @@ extern bool mmu_check_version();
extern void mmu_show_warning();
extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
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();
extern void mmu_continue_loading();
extern void mmu_filament_ramming();
extern void mmu_wait_for_heater_blocking();

View File

@ -4745,7 +4745,7 @@ static void lcd_wizard_unload()
}
else
{
mmu_eject_fil_0();
mmu_eject_filament(0, true);
}
}
else
@ -5717,30 +5717,37 @@ else {
}
}
template <uint8_t filament>
static void mmu_eject_filament()
{
menu_back();
mmu_eject_filament(filament, true);
}
static void mmu_fil_eject_menu()
{
//-//if (degHotend0() > EXTRUDE_MINTEMP)
if(bFilamentAction)
{
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();
}
else {
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed);
}
else mFilamentMenu();
}
if(bFilamentAction)
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_filament<0>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_filament<1>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_filament<2>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_filament<3>);
MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_filament<4>);
MENU_END();
}
else
{
eFilamentAction=e_FILAMENT_ACTION_mmuEject;
bFilamentFirstRun=false;
if(target_temperature[0]>=EXTRUDE_MINTEMP)
{
bFilamentPreheatState=true;
mFilamentItem(target_temperature[0],target_temperature_bed);
}
else mFilamentMenu();
}
}
#ifdef SNMM