static void lcd_menu_change_material_preheat() { #ifdef USE_CHANGE_TEMPERATURE setTargetHotend(material[active_extruder].change_temperature, active_extruder); #else setTargetHotend(material[active_extruder].temperature, active_extruder); #endif int16_t temp = degHotend(active_extruder) - 20; int16_t target = degTargetHotend(active_extruder) - 20; if (temp < 0) temp = 0; if (temp > target - 5 && temp < target + 5) { if ((signed long)(millis() - preheat_end_time) > 0) { set_extrude_min_temp(0); plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 20.0 / volume_to_filament_length[active_extruder], retract_feedrate/60.0, active_extruder); float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_REVERSAL_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -1.0 / volume_to_filament_length[active_extruder], FILAMENT_REVERSAL_SPEED, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -FILAMENT_REVERSAL_LENGTH / volume_to_filament_length[active_extruder], FILAMENT_REVERSAL_SPEED, active_extruder); max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; currentMenu = lcd_menu_change_material_remove; temp = target; } } else { #ifdef USE_CHANGE_TEMPERATURE preheat_end_time = millis() + (unsigned long)material[active_extruder].change_preheat_wait_time * 1000L; #else preheat_end_time = millis(); #endif } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_info_screen(post_change_material_menu, cancelMaterialInsert); lcd_lib_draw_stringP(3, 10, PSTR("Heating printhead")); lcd_lib_draw_stringP(3, 20, PSTR("for material removal")); lcd_progressbar(progress); lcd_lib_update_screen(); }
static void doStartPrint() { // zero the extruder position current_position[E_AXIS] = 0.0; plan_set_e_position(0); // since we are going to prime the nozzle, forget about any G10/G11 retractions that happened at end of previous print retracted = false; // note that we have primed, so that we know to de-prime at the end primed = true; // move to priming height current_position[Z_AXIS] = PRIMING_HEIGHT; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS], 0); for(uint8_t e = 0; e<EXTRUDERS; e++) { if (!LCD_DETAIL_CACHE_MATERIAL(e)) { // don't prime the extruder if it isn't used in the (Ulti)gcode // traditional gcode files typically won't have the Material lines at start, so we won't prime for those // Also, on dual/multi extrusion files, only prime the extruders that are used in the gcode-file. continue; } active_extruder = e; // undo the end-of-print retraction plan_set_e_position((0.0 - END_OF_PRINT_RETRACTION) / volume_to_filament_length[e]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], END_OF_PRINT_RECOVERY_SPEED, e); // perform additional priming plan_set_e_position(-PRIMING_MM3); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], (PRIMING_MM3_PER_SEC * volume_to_filament_length[e]), e); // for extruders other than the first one, perform end of print retraction if (e > 0) { plan_set_e_position((END_OF_PRINT_RETRACTION) / volume_to_filament_length[e]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], retract_feedrate/60, e); } } active_extruder = 0; postMenuCheck = checkPrintFinished; card.startFileprint(); lifetime_stats_print_start(); starttime = millis(); }
static void lcd_menu_change_material_preheat() { run_history = true; setTargetHotend(material[active_extruder].temperature, active_extruder); int16_t temp = degHotend(active_extruder) - 20; int16_t target = degTargetHotend(active_extruder) - 20 - 10; if (temp < 0) temp = 0; if (temp > target && !is_command_queued()) { set_extrude_min_temp(0); for(uint8_t e=0; e<EXTRUDERS; e++) volume_to_filament_length[e] = 1.0;//Set the extrusion to 1mm per given value, so we can move the filament a set distance. plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 20.0, retract_feedrate/60.0, active_extruder); float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_REVERSAL_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; current_position[E_AXIS] = 0; plan_set_e_position(current_position[E_AXIS]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -1.0, FILAMENT_REVERSAL_SPEED, active_extruder); for(uint8_t n=0; n<6; n++) plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], (n+1)*-FILAMENT_REVERSAL_LENGTH/6, FILAMENT_REVERSAL_SPEED, active_extruder); max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; currentMenu = lcd_menu_change_material_remove; temp = target; } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_info_screen(lcd_menu_material_main, cancelMaterialInsert); lcd_lib_draw_stringP(3, 0, PSTR("Heating printhead")); lcd_lib_draw_stringP(3, 10, PSTR("for material removal")); char buffer[20]; memset (buffer,0,sizeof(buffer)); char* c; c = int_to_string(temp, buffer/*, PSTR( DEGREE_C_SYMBOL )*/); *c++ = TEMPERATURE_SEPARATOR; c = int_to_string(target, c, PSTR( DEGREE_C_SYMBOL )); lcd_lib_draw_string_center(20, buffer); lcd_progressbar(progress); LED_HEAT(); lcd_lib_update_screen(); }
static void lcd_menu_change_material_remove_wait_user_ready() { current_position[E_AXIS] = 0; plan_set_e_position(current_position[E_AXIS]); lcd_change_to_menu(lcd_menu_change_material_insert_wait_user, MAIN_MENU_ITEM_POS(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); }
static void doStartPrint() { for(uint8_t e = 0; e<EXTRUDERS; e++) { if (!LCD_DETAIL_CACHE_MATERIAL(e)) continue; active_extruder = e; plan_set_e_position(-25.0 / volume_to_filament_length[e]); current_position[E_AXIS] = 0.0; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 25, e); if (e > 0) { plan_set_e_position(20.0 / volume_to_filament_length[e]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 35, e); } } active_extruder = 0; postMenuCheck = checkPrintFinished; card.startFileprint(); starttime = millis(); }
static void lcd_menu_change_material_insert() { LED_GLOW(); lcd_question_screen(post_change_material_menu, materialInsertReady, PSTR("READY"), post_change_material_menu, cancelMaterialInsert, PSTR("CANCEL")); lcd_lib_draw_string_centerP(20, PSTR("Wait till material")); lcd_lib_draw_string_centerP(30, PSTR("comes out the nozzle")); if (movesplanned() < 2) { plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 0.5 / volume_to_filament_length[active_extruder], FILAMENT_INSERT_EXTRUDE_SPEED, active_extruder); } lcd_lib_update_screen(); }
static void lcd_menu_change_material_insert_wait_user_ready() { //Override the max feedrate and acceleration values to get a better insert speed and speedup/slowdown float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_INSERT_FAST_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], FILAMENT_FORWARD_LENGTH / volume_to_filament_length[active_extruder], FILAMENT_INSERT_FAST_SPEED, active_extruder); //Put back origonal values. max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; lcd_change_to_menu(lcd_menu_change_material_insert_forward); }
static void lcd_menu_change_material_insert_wait_user() { LED_GLOW(); if (printing_state == PRINT_STATE_NORMAL && movesplanned() < 2) { plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 0.5 / volume_to_filament_length[active_extruder], FILAMENT_INSERT_SPEED, active_extruder); } lcd_question_screen(NULL, lcd_menu_change_material_insert_wait_user_ready, PSTR("READY"), post_change_material_menu, cancelMaterialInsert, PSTR("CANCEL")); lcd_lib_draw_string_centerP(10, PSTR("Insert new material")); lcd_lib_draw_string_centerP(20, PSTR("from the backside of")); lcd_lib_draw_string_centerP(30, PSTR("your machine,")); lcd_lib_draw_string_centerP(40, PSTR("above the arrow.")); lcd_lib_update_screen(); }
static void runMaterialForward() { //Override the max feedrate and acceleration values to get a better insert speed and speedup/slowdown float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_INSERT_FAST_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; current_position[E_AXIS] = 0; plan_set_e_position(current_position[E_AXIS]); current_position[E_AXIS] = FILAMENT_FORWARD_LENGTH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENT_INSERT_FAST_SPEED, 0); //Put back origonal values. max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; }
static void lcd_menu_change_material_insert_wait_user_ready() { run_history = true; //Override the max feedrate and acceleration values to get a better insert speed and speedup/slowdown float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_INSERT_FAST_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; current_position[E_AXIS] = 0; plan_set_e_position(current_position[E_AXIS]); for(uint8_t n=0; n<6; n++) { current_position[E_AXIS] += FILAMENT_FORWARD_LENGTH / 6; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENT_INSERT_FAST_SPEED, active_extruder); } //Put back origonal values. max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; lcd_change_to_menu(lcd_menu_change_material_insert_forward); }
static void materialInsertReady() { plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -END_OF_PRINT_RETRACTION / volume_to_filament_length[active_extruder], 25*60, active_extruder); cancelMaterialInsert(); }
static void lcd_menu_change_material_remove_wait_user_ready() { plan_set_e_position(0); lcd_change_to_menu(lcd_menu_change_material_select_material); }