Esempio n. 1
0
static void update_motor_power()
{
    digipot_current(0, motor_current_setting[0]);
    digipot_current(1, motor_current_setting[1]);
    digipot_current(2, motor_current_setting[2]);
    Config_StoreSettings();
}
static void lcd_menu_first_run_material_select_material()
{
    LED_GLOW();
    uint8_t count = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());

    lcd_scroll_menu(PSTR("MATERIAL"), count, lcd_material_select_callback, lcd_material_select_details_callback);
    CLEAR_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.

        for(uint8_t e=0; e<EXTRUDERS; e++)
            lcd_material_set_material(SELECTED_SCROLL_MENU_ITEM(), e);
        SET_FIRST_RUN_DONE();
        lcd_change_to_menu(lcd_menu_first_run_material_select_confirm_material);
        strcat_P(card.longFilename, PSTR(" as material,"));
    }
}
static void lcd_menu_change_material_insert_forward()
{
    lcd_info_screen(lcd_menu_main, cancelMaterialInsert);
    lcd_lib_draw_stringP(3, 20, PSTR("Forwarding material"));
    
    if (!blocks_queued())
    {
        lcd_lib_beep();
        led_glow_dir = led_glow = 0;
        
        digipot_current(2, motor_current_setting[2]*2/3);//Set the E motor power lower to we skip instead of grind.
        currentMenu = lcd_menu_change_material_insert;
        SELECT_MAIN_MENU_ITEM(0);
    }

    long pos = st_get_position(E_AXIS);
    long targetPos = lround(FILAMENT_FORWARD_LENGTH*axis_steps_per_unit[E_AXIS]);
    uint8_t progress = (pos * 125 / targetPos);
    lcd_progressbar(progress);
    
    lcd_lib_update_screen();
}
static void lcd_menu_first_run_material_load_forward()
{
    lcd_basic_screen();
    DRAW_PROGRESS_NR(14);
    lcd_lib_draw_string_centerP(20, PSTR("Loading material..."));
    
    if (!blocks_queued())
    {
        lcd_lib_beep();
        led_glow_dir = led_glow = 0;
        digipot_current(2, motor_current_setting[2]*2/3);//Set E motor power lower so the motor will skip instead of grind.
        currentMenu = lcd_menu_first_run_material_load_wait;
        SELECT_MAIN_MENU_ITEM(0);
    }

    long pos = st_get_position(E_AXIS);
    long targetPos = lround(FILAMENT_FORWARD_LENGTH*axis_steps_per_unit[E_AXIS]);
    uint8_t progress = (pos * 125 / targetPos);
    lcd_progressbar(progress);
    
    lcd_lib_update_screen();
}
static void lcd_menu_first_run_material_select_1()
{
    if (eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET()) == 1)
    {
        digipot_current(2, motor_current_setting[2]);//Set E motor power to default.
        
        for(uint8_t e=0; e<EXTRUDERS; e++)
            lcd_material_set_material(0, e);
        SET_FIRST_RUN_DONE();
        
        currentMenu = lcd_menu_first_run_print_1;
        return;
    }
    SELECT_MAIN_MENU_ITEM(0);
    lcd_info_screen(lcd_menu_first_run_material_select_material, doCooldown, PSTR("READY"));
    DRAW_PROGRESS_NR(16);
    lcd_lib_draw_string_centerP(10, PSTR("Next, select the"));
    lcd_lib_draw_string_centerP(20, PSTR("material you have"));
    lcd_lib_draw_string_centerP(30, PSTR("inserted in this"));
    lcd_lib_draw_string_centerP(40, PSTR("Ultimaker2."));
    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);
        }
    }
}
static void cancelMaterialInsert()
{
    digipot_current(2, motor_current_setting[2]);//Set E motor power to default.
    doCooldown();
    enquecommand_P(PSTR("G28 X0 Y0"));
}
static void cancelMaterialInsert()
{
    set_extrude_min_temp(EXTRUDE_MINTEMP);
    digipot_current(2, motor_current_setting[2]);//Set E motor power to default.
}