void lcd_menu_material()
{
#if EXTRUDERS > 1
    lcd_tripple_menu(PSTR("PRIMARY|NOZZLE"), PSTR("SECONDARY|NOZZLE"), PSTR("RETURN"));

    if (lcd_lib_button_pressed)
    {
        if (IS_SELECTED_MAIN(0))
        {
            active_extruder = 0;
            lcd_change_to_menu(lcd_menu_material_main);
        }
        else if (IS_SELECTED_MAIN(1))
        {
            active_extruder = 1;
            lcd_change_to_menu(lcd_menu_material_main);
        }
        else if (IS_SELECTED_MAIN(2))
            lcd_change_to_menu(lcd_menu_main);
    }

    lcd_lib_update_screen();
#else
    currentMenu = lcd_menu_material_main;
#endif
}
void lcd_menu_maintenance()
{
    lcd_tripple_menu(PSTR("BUILD-|PLATE"), PSTR("ADVANCED"), PSTR("RETURN"));

    if (lcd_lib_button_pressed)
    {
        if (IS_SELECTED_MAIN(0))
            lcd_change_to_menu(lcd_menu_first_run_start_bed_leveling);
        else if (IS_SELECTED_MAIN(1))
            lcd_change_to_menu(lcd_menu_maintenance_advanced);
        else if (IS_SELECTED_MAIN(2))
            lcd_change_to_menu(lcd_menu_main);
    }

    lcd_lib_update_screen();
}
void lcd_menu_maintenance()
{
    lcd_tripple_menu(PSTR("TISKOVA|PODLOZKA"), PSTR("POKROCILE|NASTAVENI"), PSTR("ZPET"));

    if (lcd_lib_button_pressed)
    {
        if (IS_SELECTED_MAIN(0))
            lcd_change_to_menu(lcd_menu_first_run_start_bed_leveling);
        else if (IS_SELECTED_MAIN(1))
            lcd_change_to_menu(lcd_menu_maintenance_advanced);
        else if (IS_SELECTED_MAIN(2))
            lcd_change_to_menu(lcd_menu_main);
    }

    lcd_lib_update_screen();
}
static void lcd_menu_material_main()
{
    lcd_tripple_menu(PSTR("CHANGE"), PSTR("SETTINGS"), PSTR("RETURN"));

    if (lcd_lib_button_pressed)
    {
        if (IS_SELECTED_MAIN(0))
        {
            minProgress = 0;
            lcd_change_to_menu(lcd_menu_change_material_preheat);
        }
        else if (IS_SELECTED_MAIN(1))
            lcd_change_to_menu(lcd_menu_material_select, SCROLL_MENU_ITEM_POS(0));
        else if (IS_SELECTED_MAIN(2))
            lcd_change_to_menu(lcd_menu_main);
    }

    lcd_lib_update_screen();
}
static void lcd_menu_material_main()
{
    lcd_tripple_menu(PSTR("CHANGE"), PSTR("SETTINGS"), PSTR("RETURN"));

    if (lcd_lib_button_pressed)
    {
        if (IS_SELECTED_MAIN(0) && !is_command_queued())
        {
            minProgress = 0;
            char buffer[32];
            enquecommand_P(PSTR("G28 X0 Y0"));
            sprintf_P(buffer, PSTR("G1 F%i X%i Y%i"), int(homing_feedrate[0]), X_MAX_LENGTH/2, 10);
            enquecommand(buffer);
            lcd_change_to_menu_change_material(lcd_menu_material_main_return);
        }
        else if (IS_SELECTED_MAIN(1))
            lcd_change_to_menu(lcd_menu_material_select, SCROLL_MENU_ITEM_POS(0));
        else if (IS_SELECTED_MAIN(2))
            lcd_change_to_menu(lcd_menu_main);
    }

    lcd_lib_update_screen();
}
static void lcd_menu_first_run_material_select_pla_abs()
{
    LED_GLOW();
    lcd_tripple_menu(PSTR("PLA"), PSTR("ABS"), NULL);
    DRAW_PROGRESS_NR(17);
    lcd_lib_update_screen();
    
    if (lcd_lib_button_pressed)
    {
        digipot_current(2, motor_current_setting[2]);//Set E motor power to default.
        if (IS_SELECTED_MAIN(0))
        {
            lcd_material_reset_defaults();
            lcd_material_set_material(0);
            lcd_change_to_menu(lcd_menu_first_run_material_select_confirm_pla);
        }
        else if (IS_SELECTED_MAIN(1))
        {
            lcd_material_reset_defaults();
            lcd_material_set_material(1);
            lcd_change_to_menu(lcd_menu_first_run_material_select_confirm_abs);
        }
    }
}