123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865 |
-
-
-
-
- #include "MarlinConfig.h"
-
- #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_EDITING)
-
- #include "ubl.h"
- #include "Marlin.h"
- #include "planner.h"
- #include "stepper.h"
- #include "temperature.h"
- #include "ultralcd.h"
-
- #define EXTRUSION_MULTIPLIER 1.0
- #define RETRACTION_MULTIPLIER 1.0
- #define NOZZLE 0.3
- #define FILAMENT 1.75
- #define LAYER_HEIGHT 0.2
- #define PRIME_LENGTH 10.0
- #define BED_TEMP 60.0
- #define HOTEND_TEMP 205.0
- #define OOZE_AMOUNT 0.3
-
- #define SIZE_OF_INTERSECTION_CIRCLES 5
- #define SIZE_OF_CROSSHAIRS 3
-
- #if SIZE_OF_CROSSHAIRS >= SIZE_OF_INTERSECTION_CIRCLES
- #error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
- #endif
-
-
-
-
- extern float feedrate;
- extern Planner planner;
-
- extern char lcd_status_message[];
-
- extern float destination[XYZE];
- extern void set_destination_to_current();
- extern void set_current_to_destination();
- extern float code_value_float();
- extern bool code_value_bool();
- extern bool code_has_value();
- extern void lcd_init();
- extern void lcd_setstatuspgm(const char* const message, const uint8_t level);
- #define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
- bool prepare_move_to_destination_cartesian();
- void line_to_destination();
- void line_to_destination(float );
- void gcode_G28();
- void sync_plan_position_e();
- void un_retract_filament(float where[XYZE]);
- void retract_filament(float where[XYZE]);
- void look_for_lines_to_connect();
- bool parse_G26_parameters();
- void move_to(const float&, const float&, const float&, const float&) ;
- void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
- bool turn_on_heaters();
- bool prime_nozzle();
- void chirp_at_user();
-
- static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
- float g26_e_axis_feedrate = 0.020,
- random_deviation = 0.0,
- layer_height = LAYER_HEIGHT;
-
- bool g26_retracted = false;
-
-
-
-
- float valid_trig_angle(float);
- mesh_index_pair find_closest_circle_to_print(const float&, const float&);
-
- static float extrusion_multiplier = EXTRUSION_MULTIPLIER,
- retraction_multiplier = RETRACTION_MULTIPLIER,
- nozzle = NOZZLE,
- filament_diameter = FILAMENT,
- prime_length = PRIME_LENGTH,
- x_pos, y_pos,
- bed_temp = BED_TEMP,
- hotend_temp = HOTEND_TEMP,
- ooze_amount = OOZE_AMOUNT;
-
- int8_t prime_flag = 0;
-
- bool keep_heaters_on = false;
-
-
-
- void gcode_G26() {
- float tmp, start_angle, end_angle;
- int i, xi, yi;
- mesh_index_pair location;
-
-
-
- if (axis_unhomed_error(true, true, true) || parse_G26_parameters()) return;
-
- if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
- do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
- stepper.synchronize();
- set_current_to_destination();
- }
-
- if (turn_on_heaters()) goto LEAVE;
-
- current_position[E_AXIS] = 0.0;
- sync_plan_position_e();
-
- if (prime_flag && prime_nozzle()) goto LEAVE;
-
-
-
-
- ZERO(circle_flags);
- ZERO(horizontal_mesh_line_flags);
- ZERO(vertical_mesh_line_flags);
-
-
- set_destination_to_current();
- destination[Z_AXIS] = layer_height;
- move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
- move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
-
- ubl.has_control_of_lcd_panel = true;
-
-
-
-
- float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
- for (i = 0; i <= 360 / 30; i++) {
- cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
- sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
- }
-
- do {
-
- if (ubl_lcd_clicked()) {
- #if ENABLED(ULTRA_LCD)
- lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
- lcd_quick_feedback();
- #endif
- while (!ubl_lcd_clicked()) {
- idle();
- lcd_reset_alert_level();
- lcd_setstatuspgm(PSTR(""));
- }
- while (ubl_lcd_clicked()) {
- idle();
- lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
- }
- goto LEAVE;
- }
-
- location = continue_with_closest
- ? find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS])
- : find_closest_circle_to_print(x_pos, y_pos);
-
- if (location.x_index >= 0 && location.y_index >= 0) {
- const float circle_x = pgm_read_float(&(ubl.mesh_index_to_xpos[location.x_index])),
- circle_y = pgm_read_float(&(ubl.mesh_index_to_ypos[location.y_index]));
-
-
- #ifdef DELTA
- if (HYPOT2(circle_x, circle_y) > sq(DELTA_PRINTABLE_RADIUS)) {
- SERIAL_ERROR_START;
- SERIAL_ERRORLNPGM("Attempt to print outside of DELTA_PRINTABLE_RADIUS.");
- goto LEAVE;
- }
- #endif
-
-
- if (!WITHIN(circle_x, X_MIN_POS, X_MAX_POS) || !WITHIN(circle_y, Y_MIN_POS, Y_MAX_POS)) {
- SERIAL_ERROR_START;
- SERIAL_ERRORLNPGM("Attempt to print off the bed.");
- goto LEAVE;
- }
-
- xi = location.x_index;
- yi = location.y_index;
-
- if (ubl.g26_debug_flag) {
- SERIAL_ECHOPAIR(" Doing circle at: (xi=", xi);
- SERIAL_ECHOPAIR(", yi=", yi);
- SERIAL_CHAR(')');
- SERIAL_EOL;
- }
-
- start_angle = 0.0;
- end_angle = 360.0;
- if (xi == 0) {
- start_angle = -90.0;
- end_angle = 90.0;
- if (yi == 0)
- start_angle = 0.0;
- else if (yi == GRID_MAX_POINTS_Y - 1)
- end_angle = 0.0;
- }
- else if (xi == GRID_MAX_POINTS_X - 1) {
- start_angle = 90.0;
- end_angle = 270.0;
- if (yi == 0)
- end_angle = 180.0;
- else if (yi == GRID_MAX_POINTS_Y - 1)
- start_angle = 180.0;
- }
- else if (yi == 0) {
- start_angle = 0.0;
- end_angle = 180.0;
- }
- else if (yi == GRID_MAX_POINTS_Y - 1) {
- start_angle = 180.0;
- end_angle = 360.0;
- }
-
- for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
- int tmp_div_30 = tmp / 30.0;
- if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
- if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
-
- float x = circle_x + cos_table[tmp_div_30],
- y = circle_y + sin_table[tmp_div_30],
- xe = circle_x + cos_table[tmp_div_30 + 1],
- ye = circle_y + sin_table[tmp_div_30 + 1];
- #ifdef DELTA
- if (HYPOT2(x, y) > sq(DELTA_PRINTABLE_RADIUS))
- continue;
- #else
- x = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1);
- y = constrain(y, Y_MIN_POS + 1, Y_MAX_POS - 1);
- xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
- ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
- print_line_from_here_to_there(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), layer_height, LOGICAL_X_POSITION(xe), LOGICAL_Y_POSITION(ye), layer_height);
-
- }
-
-
- look_for_lines_to_connect();
-
- }
-
-
-
- } while (location.x_index >= 0 && location.y_index >= 0);
-
- LEAVE:
- lcd_reset_alert_level();
- lcd_setstatuspgm(PSTR("Leaving G26"));
-
- retract_filament(destination);
- destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
-
-
- move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0);
-
-
- destination[X_AXIS] = x_pos;
- destination[Y_AXIS] = y_pos;
-
-
- move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0);
-
-
- ubl.has_control_of_lcd_panel = false;
-
- if (!keep_heaters_on) {
- #if HAS_TEMP_BED
- thermalManager.setTargetBed(0.0);
- #endif
- thermalManager.setTargetHotend(0.0, 0);
- }
- }
-
-
- float valid_trig_angle(float d) {
- while (d > 360.0) d -= 360.0;
- while (d < 0.0) d += 360.0;
- return d;
- }
-
- mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) {
- float closest = 99999.99;
- mesh_index_pair return_val;
-
- return_val.x_index = return_val.y_index = -1;
-
- for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
- for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
- if (!is_bit_set(circle_flags, i, j)) {
- const float mx = pgm_read_float(&(ubl.mesh_index_to_xpos[i])),
- my = pgm_read_float(&(ubl.mesh_index_to_ypos[j]));
-
-
- float f = HYPOT(X - mx, Y - my);
-
-
-
-
-
- f += HYPOT(x_pos - mx, y_pos - my) / 15.0;
-
-
- if (random_deviation > 1.0)
- f += random(0.0, random_deviation);
-
- if (f < closest) {
- closest = f;
- return_val.x_index = i;
- return_val.y_index = j;
- return_val.distance = closest;
- }
- }
- }
- }
- bit_set(circle_flags, return_val.x_index, return_val.y_index);
- return return_val;
- }
-
- void look_for_lines_to_connect() {
- float sx, sy, ex, ey;
-
- for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
- for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
-
- if (i < GRID_MAX_POINTS_X) {
-
-
- if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) {
- if (!is_bit_set(horizontal_mesh_line_flags, i, j)) {
-
-
-
-
-
- sx = pgm_read_float(&(ubl.mesh_index_to_xpos[ i ])) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS));
- ex = pgm_read_float(&(ubl.mesh_index_to_xpos[i + 1])) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS));
-
- sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1);
- sy = ey = constrain(pgm_read_float(&(ubl.mesh_index_to_ypos[j])), Y_MIN_POS + 1, Y_MAX_POS - 1);
- ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
-
- if (ubl.g26_debug_flag) {
- SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
- SERIAL_ECHOPAIR(", sy=", sy);
- SERIAL_ECHOPAIR(") -> (ex=", ex);
- SERIAL_ECHOPAIR(", ey=", ey);
- SERIAL_CHAR(')');
- SERIAL_EOL;
-
- }
-
- print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), layer_height);
- bit_set(horizontal_mesh_line_flags, i, j);
- }
- }
-
- if (j < GRID_MAX_POINTS_Y) {
-
-
- if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i, j + 1)) {
- if (!is_bit_set( vertical_mesh_line_flags, i, j)) {
-
-
-
-
- sy = pgm_read_float(&(ubl.mesh_index_to_ypos[ j ])) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS));
- ey = pgm_read_float(&(ubl.mesh_index_to_ypos[j + 1])) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS));
-
- sx = ex = constrain(pgm_read_float(&(ubl.mesh_index_to_xpos[i])), X_MIN_POS + 1, X_MAX_POS - 1);
- sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
- ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
-
- if (ubl.g26_debug_flag) {
- SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
- SERIAL_ECHOPAIR(", sy=", sy);
- SERIAL_ECHOPAIR(") -> (ex=", ex);
- SERIAL_ECHOPAIR(", ey=", ey);
- SERIAL_CHAR(')');
- SERIAL_EOL;
- debug_current_and_destination(PSTR("Connecting vertical line."));
- }
- print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), layer_height);
- bit_set(vertical_mesh_line_flags, i, j);
- }
- }
- }
- }
- }
- }
- }
-
- void move_to(const float &x, const float &y, const float &z, const float &e_delta) {
- float feed_value;
- static float last_z = -999.99;
-
- bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]);
-
-
-
- if (z != last_z) {
-
-
- last_z = z;
- feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0);
-
- destination[X_AXIS] = current_position[X_AXIS];
- destination[Y_AXIS] = current_position[Y_AXIS];
- destination[Z_AXIS] = z;
- destination[E_AXIS] = current_position[E_AXIS];
-
- ubl_line_to_destination(feed_value, 0);
-
- stepper.synchronize();
- set_destination_to_current();
-
-
- }
-
-
-
- feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5;
-
- if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
-
- destination[X_AXIS] = x;
- destination[Y_AXIS] = y;
- destination[E_AXIS] += e_delta;
-
-
-
- ubl_line_to_destination(feed_value, 0);
-
-
-
- stepper.synchronize();
- set_destination_to_current();
-
- }
-
- void retract_filament(float where[XYZE]) {
- if (!g26_retracted) {
- g26_retracted = true;
-
- move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], -1.0 * retraction_multiplier);
-
- }
- }
-
- void un_retract_filament(float where[XYZE]) {
- if (g26_retracted) {
- move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], 1.2 * retraction_multiplier);
- g26_retracted = false;
-
- }
- }
-
-
-
- void print_line_from_here_to_there(const float &sx, const float &sy, const float &sz, const float &ex, const float &ey, const float &ez) {
- const float dx_s = current_position[X_AXIS] - sx,
- dy_s = current_position[Y_AXIS] - sy,
- dist_start = HYPOT2(dx_s, dy_s),
-
- dx_e = current_position[X_AXIS] - ex,
- dy_e = current_position[Y_AXIS] - ey,
- dist_end = HYPOT2(dx_e, dy_e),
-
- line_length = HYPOT(ex - sx, ey - sy);
-
-
-
- if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(line_length)) {
-
- return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
- }
-
-
-
- if (dist_start > 2.0) {
- retract_filament(destination);
-
- }
- move_to(sx, sy, sz, 0.0);
-
- const float e_pos_delta = line_length * g26_e_axis_feedrate * extrusion_multiplier;
-
- un_retract_filament(destination);
-
-
-
-
-
- move_to(ex, ey, ez, e_pos_delta);
- }
-
-
-
- bool parse_G26_parameters() {
-
- extrusion_multiplier = EXTRUSION_MULTIPLIER;
- retraction_multiplier = RETRACTION_MULTIPLIER;
- nozzle = NOZZLE;
- filament_diameter = FILAMENT;
- layer_height = LAYER_HEIGHT;
- prime_length = PRIME_LENGTH;
- bed_temp = BED_TEMP;
- hotend_temp = HOTEND_TEMP;
- ooze_amount = OOZE_AMOUNT;
- prime_flag = 0;
- keep_heaters_on = false;
-
- if (code_seen('B')) {
- bed_temp = code_value_float();
- if (!WITHIN(bed_temp, 15.0, 140.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
- return UBL_ERR;
- }
- }
-
- if (code_seen('C')) continue_with_closest++;
-
- if (code_seen('L')) {
- layer_height = code_value_float();
- if (!WITHIN(layer_height, 0.0, 2.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
- return UBL_ERR;
- }
- }
-
- if (code_seen('Q')) {
- if (code_has_value()) {
- retraction_multiplier = code_value_float();
- if (!WITHIN(retraction_multiplier, 0.05, 15.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
- return UBL_ERR;
- }
- }
- else {
- SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
- return UBL_ERR;
- }
- }
-
- if (code_seen('N')) {
- nozzle = code_value_float();
- if (!WITHIN(nozzle, 0.1, 1.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
- return UBL_ERR;
- }
- }
-
- if (code_seen('K')) keep_heaters_on++;
-
- if (code_seen('O') && code_has_value())
- ooze_amount = code_value_float();
-
- if (code_seen('P')) {
- if (!code_has_value())
- prime_flag = -1;
- else {
- prime_flag++;
- prime_length = code_value_float();
- if (!WITHIN(prime_length, 0.0, 25.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
- return UBL_ERR;
- }
- }
- }
-
- if (code_seen('F')) {
- filament_diameter = code_value_float();
- if (!WITHIN(filament_diameter, 1.0, 4.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
- return UBL_ERR;
- }
- }
- extrusion_multiplier *= sq(1.75) / sq(filament_diameter);
-
-
-
- extrusion_multiplier *= filament_diameter * sq(nozzle) / sq(0.3);
-
- if (code_seen('H')) {
- hotend_temp = code_value_float();
- if (!WITHIN(hotend_temp, 165.0, 280.0)) {
- SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
- return UBL_ERR;
- }
- }
-
- if (code_seen('R')) {
- randomSeed(millis());
- random_deviation = code_has_value() ? code_value_float() : 50.0;
- }
-
- x_pos = current_position[X_AXIS];
- y_pos = current_position[Y_AXIS];
-
- if (code_seen('X')) {
- x_pos = code_value_float();
- if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
- SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
- return UBL_ERR;
- }
- }
- else
-
- if (code_seen('Y')) {
- y_pos = code_value_float();
- if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
- SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
- return UBL_ERR;
- }
- }
-
-
-
- ubl.state.active = !code_seen('D');
-
- return UBL_OK;
- }
-
- bool exit_from_g26() {
-
- lcd_reset_alert_level();
- lcd_setstatuspgm(PSTR("Leaving G26"));
- while (ubl_lcd_clicked()) idle();
- return UBL_ERR;
- }
-
-
-
- bool turn_on_heaters() {
- #if HAS_TEMP_BED
- #if ENABLED(ULTRA_LCD)
- if (bed_temp > 25) {
- lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99);
- lcd_quick_feedback();
- #endif
- ubl.has_control_of_lcd_panel = true;
- thermalManager.setTargetBed(bed_temp);
- while (abs(thermalManager.degBed() - bed_temp) > 3) {
- if (ubl_lcd_clicked()) return exit_from_g26();
- idle();
- }
- #if ENABLED(ULTRA_LCD)
- }
- lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99);
- lcd_quick_feedback();
- #endif
- #endif
-
-
- thermalManager.setTargetHotend(hotend_temp, 0);
- while (abs(thermalManager.degHotend(0) - hotend_temp) > 3) {
- if (ubl_lcd_clicked()) return exit_from_g26();
- idle();
- }
-
- #if ENABLED(ULTRA_LCD)
- lcd_reset_alert_level();
- lcd_setstatuspgm(PSTR(""));
- lcd_quick_feedback();
- #endif
-
- return UBL_OK;
- }
-
-
-
- bool prime_nozzle() {
- float Total_Prime = 0.0;
-
- if (prime_flag == -1) {
-
- ubl.has_control_of_lcd_panel = true;
-
- lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99);
- chirp_at_user();
-
- set_destination_to_current();
-
- un_retract_filament(destination);
-
- 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
- ubl_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0);
-
- stepper.synchronize();
-
-
-
- set_destination_to_current();
- idle();
- }
-
- while (ubl_lcd_clicked()) idle();
-
- #if ENABLED(ULTRA_LCD)
- strcpy_P(lcd_status_message, PSTR("Done Priming"));
-
- lcd_setstatuspgm(PSTR("Done Priming"), 99);
- lcd_quick_feedback();
- #endif
-
- ubl.has_control_of_lcd_panel = false;
-
- }
- else {
- #if ENABLED(ULTRA_LCD)
- lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99);
- lcd_quick_feedback();
- #endif
- set_destination_to_current();
- destination[E_AXIS] += prime_length;
- ubl_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0, 0);
- stepper.synchronize();
- set_destination_to_current();
- retract_filament(destination);
- }
-
- return UBL_OK;
- }
-
- #endif
|