void move_to(const float &rx, const float &ry, const float &z, const float &e_delta) { float feed_value; static float last_z = -999.99; bool has_xy_component = (rx != current_position[X_AXIS] || ry != current_position[Y_AXIS]); // Check if X or Y is involved in the movement. if (z != last_z) { last_z = z; feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(2.0); // Base the feed rate off of the configured Z_AXIS feed rate destination[X_AXIS] = current_position[X_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS]; destination[Z_AXIS] = z; // We know the last_z!=z or we wouldn't be in this block of code. destination[E_AXIS] = current_position[E_AXIS]; G26_line_to_destination(feed_value); set_destination_from_current(); } // Check if X or Y is involved in the movement. // Yes: a 'normal' movement. No: a retract() or recover() feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 3.0 : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5; if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value); destination[X_AXIS] = rx; destination[Y_AXIS] = ry; destination[E_AXIS] += e_delta; G26_line_to_destination(feed_value); set_destination_from_current(); }
/** * Prime the nozzle if needed. Return true on error. */ inline bool prime_nozzle() { #if HAS_LCD_MENU #if ENABLED(PREVENT_LENGTHY_EXTRUDE) float Total_Prime = 0.0; #endif if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged ui.capture(); ui.set_status_P(PSTR("User-Controlled Prime"), 99); ui.chirp(); set_destination_from_current(); recover_filament(destination); // Make sure G26 doesn't think the filament is retracted(). while (!ui.button_pressed()) { ui.chirp(); destination[E_AXIS] += 0.25; #if ENABLED(PREVENT_LENGTHY_EXTRUDE) Total_Prime += 0.25; if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR; #endif G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0); set_destination_from_current(); planner.synchronize(); // Without this synchronize, the purge is more consistent, // but because the planner has a buffer, we won't be able // to stop as quickly. So we put up with the less smooth // action to give the user a more responsive 'Stop'. } ui.wait_for_release(); ui.set_status_P(PSTR("Done Priming"), 99); ui.quick_feedback(); ui.release(); } else #endif { #if ENABLED(ULTRA_LCD) ui.set_status_P(PSTR("Fixed Length Prime."), 99); ui.quick_feedback(); #endif set_destination_from_current(); destination[E_AXIS] += g26_prime_length; G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0); set_destination_from_current(); retract_filament(destination); } return G26_OK; }
/** * Prime the nozzle if needed. Return true on error. */ bool unified_bed_leveling::prime_nozzle() { #if ENABLED(NEWPANEL) float Total_Prime = 0.0; if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged has_control_of_lcd_panel = true; lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); chirp_at_user(); set_destination_to_current(); recover_filament(destination); // Make sure G26 doesn't think the filament is retracted(). while (!ubl_lcd_clicked()) { chirp_at_user(); destination[E_AXIS] += 0.25; #ifdef PREVENT_LENGTHY_EXTRUDE Total_Prime += 0.25; if (Total_Prime >= EXTRUDE_MAXLENGTH) return UBL_ERR; #endif G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); stepper.synchronize(); // Without this synchronize, the purge is more consistent, // but because the planner has a buffer, we won't be able // to stop as quickly. So we put up with the less smooth // action to give the user a more responsive 'Stop'. set_destination_to_current(); idle(); } while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel #if ENABLED(ULTRA_LCD) strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue; // So... We cheat to get a message up. lcd_setstatusPGM(PSTR("Done Priming"), 99); lcd_quick_feedback(); #endif has_control_of_lcd_panel = false; } else { #else { #endif #if ENABLED(ULTRA_LCD) lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); lcd_quick_feedback(); #endif set_destination_to_current(); destination[E_AXIS] += g26_prime_length; G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); stepper.synchronize(); set_destination_to_current(); retract_filament(destination); } return UBL_OK; }