|
@@ -144,7 +144,7 @@
|
144
|
144
|
|
145
|
145
|
void un_retract_filament(float where[XYZE]);
|
146
|
146
|
void retract_filament(float where[XYZE]);
|
147
|
|
- void look_for_lines_to_connect();
|
|
147
|
+ bool look_for_lines_to_connect();
|
148
|
148
|
bool parse_G26_parameters();
|
149
|
149
|
void move_to(const float&, const float&, const float&, const float&) ;
|
150
|
150
|
void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
|
|
@@ -249,24 +249,6 @@
|
249
|
249
|
}
|
250
|
250
|
|
251
|
251
|
do {
|
252
|
|
-
|
253
|
|
- if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
254
|
|
- #if ENABLED(ULTRA_LCD)
|
255
|
|
- lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
256
|
|
- lcd_quick_feedback();
|
257
|
|
- #endif
|
258
|
|
- while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
259
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
260
|
|
- lcd_reset_alert_level();
|
261
|
|
- lcd_setstatuspgm(PSTR(""));
|
262
|
|
- }
|
263
|
|
- while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
264
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
265
|
|
- lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
|
266
|
|
- }
|
267
|
|
- goto LEAVE;
|
268
|
|
- }
|
269
|
|
-
|
270
|
252
|
location = continue_with_closest
|
271
|
253
|
? find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS])
|
272
|
254
|
: find_closest_circle_to_print(x_pos, y_pos); // Find the closest Mesh Intersection to where we are now.
|
|
@@ -317,6 +299,27 @@
|
317
|
299
|
}
|
318
|
300
|
|
319
|
301
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
|
302
|
+
|
|
303
|
+ // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
|
|
304
|
+ // a Press and Hold is repeated in a lot of places (including ubl_G29.cpp). This
|
|
305
|
+ // should be redone and compressed.
|
|
306
|
+ if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
|
307
|
+ #if ENABLED(ULTRA_LCD)
|
|
308
|
+ lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
|
309
|
+ lcd_quick_feedback();
|
|
310
|
+ #endif
|
|
311
|
+ while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
312
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
313
|
+ lcd_reset_alert_level();
|
|
314
|
+ lcd_setstatuspgm(PSTR(""));
|
|
315
|
+ }
|
|
316
|
+ while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
317
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
318
|
+ lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
|
|
319
|
+ }
|
|
320
|
+ goto LEAVE;
|
|
321
|
+ }
|
|
322
|
+
|
320
|
323
|
int tmp_div_30 = tmp / 30.0;
|
321
|
324
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
322
|
325
|
if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
|
|
@@ -349,14 +352,9 @@
|
349
|
352
|
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);
|
350
|
353
|
|
351
|
354
|
}
|
352
|
|
-
|
353
|
|
- //debug_current_and_destination(PSTR("Looking for lines to connect."));
|
354
|
|
- look_for_lines_to_connect();
|
355
|
|
- //debug_current_and_destination(PSTR("Done with line connect."));
|
|
355
|
+ if (look_for_lines_to_connect())
|
|
356
|
+ goto LEAVE;
|
356
|
357
|
}
|
357
|
|
-
|
358
|
|
- //debug_current_and_destination(PSTR("Done with current circle."));
|
359
|
|
-
|
360
|
358
|
} while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
|
361
|
359
|
|
362
|
360
|
LEAVE:
|
|
@@ -432,12 +430,32 @@
|
432
|
430
|
return return_val;
|
433
|
431
|
}
|
434
|
432
|
|
435
|
|
- void look_for_lines_to_connect() {
|
|
433
|
+ bool look_for_lines_to_connect() {
|
436
|
434
|
float sx, sy, ex, ey;
|
437
|
435
|
|
438
|
436
|
for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
|
439
|
437
|
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
440
|
438
|
|
|
439
|
+ // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
|
|
440
|
+ // a Press and Hold is repeated in a lot of places (including ubl_G29.cpp). This
|
|
441
|
+ // should be redone and compressed.
|
|
442
|
+ if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
|
443
|
+ #if ENABLED(ULTRA_LCD)
|
|
444
|
+ lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
|
445
|
+ lcd_quick_feedback();
|
|
446
|
+ #endif
|
|
447
|
+ while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
448
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
449
|
+ lcd_reset_alert_level();
|
|
450
|
+ lcd_setstatuspgm(PSTR(""));
|
|
451
|
+ }
|
|
452
|
+ while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
453
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
454
|
+ lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
|
|
455
|
+ }
|
|
456
|
+ return true;
|
|
457
|
+ }
|
|
458
|
+
|
441
|
459
|
if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
|
442
|
460
|
// This is already a half circle because we are at the edge of the bed.
|
443
|
461
|
|
|
@@ -509,6 +527,7 @@
|
509
|
527
|
}
|
510
|
528
|
}
|
511
|
529
|
}
|
|
530
|
+ return false;
|
512
|
531
|
}
|
513
|
532
|
|
514
|
533
|
void move_to(const float &x, const float &y, const float &z, const float &e_delta) {
|
|
@@ -517,11 +536,7 @@
|
517
|
536
|
|
518
|
537
|
bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
519
|
538
|
|
520
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() has_xy_component:", (int)has_xy_component);
|
521
|
|
-
|
522
|
539
|
if (z != last_z) {
|
523
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() changing Z to ", (int)z);
|
524
|
|
-
|
525
|
540
|
last_z = z;
|
526
|
541
|
feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate
|
527
|
542
|
|
|
@@ -534,8 +549,6 @@
|
534
|
549
|
|
535
|
550
|
stepper.synchronize();
|
536
|
551
|
set_destination_to_current();
|
537
|
|
-
|
538
|
|
- //if (ubl.g26_debug_flag) debug_current_and_destination(PSTR(" in move_to() done with Z move"));
|
539
|
552
|
}
|
540
|
553
|
|
541
|
554
|
// Check if X or Y is involved in the movement.
|
|
@@ -548,12 +561,8 @@
|
548
|
561
|
destination[Y_AXIS] = y;
|
549
|
562
|
destination[E_AXIS] += e_delta;
|
550
|
563
|
|
551
|
|
- //if (ubl.g26_debug_flag) debug_current_and_destination(PSTR(" in move_to() doing last move"));
|
552
|
|
-
|
553
|
564
|
G26_line_to_destination(feed_value);
|
554
|
565
|
|
555
|
|
- //if (ubl.g26_debug_flag) debug_current_and_destination(PSTR(" in move_to() after last move"));
|
556
|
|
-
|
557
|
566
|
stepper.synchronize();
|
558
|
567
|
set_destination_to_current();
|
559
|
568
|
|
|
@@ -562,9 +571,7 @@
|
562
|
571
|
void retract_filament(float where[XYZE]) {
|
563
|
572
|
if (!g26_retracted) { // Only retract if we are not already retracted!
|
564
|
573
|
g26_retracted = true;
|
565
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
|
566
|
574
|
move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], -1.0 * retraction_multiplier);
|
567
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
|
568
|
575
|
}
|
569
|
576
|
}
|
570
|
577
|
|
|
@@ -572,7 +579,6 @@
|
572
|
579
|
if (g26_retracted) { // Only un-retract if we are retracted.
|
573
|
580
|
move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], 1.2 * retraction_multiplier);
|
574
|
581
|
g26_retracted = false;
|
575
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
|
576
|
582
|
}
|
577
|
583
|
}
|
578
|
584
|
|
|
@@ -605,7 +611,6 @@
|
605
|
611
|
// If the end point of the line is closer to the nozzle, flip the direction,
|
606
|
612
|
// moving from the end to the start. On very small lines the optimization isn't worth it.
|
607
|
613
|
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(line_length)) {
|
608
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Reversing start and end of print_line_from_here_to_there()");
|
609
|
614
|
return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
610
|
615
|
}
|
611
|
616
|
|
|
@@ -613,9 +618,6 @@
|
613
|
618
|
|
614
|
619
|
if (dist_start > 2.0) {
|
615
|
620
|
retract_filament(destination);
|
616
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" filament retracted.");
|
617
|
|
-
|
618
|
|
- //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Z bumping by 0.500 to minimize scraping.");
|
619
|
621
|
//todo: parameterize the bump height with a define
|
620
|
622
|
move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 0.500, 0.0); // Z bump to minimize scraping
|
621
|
623
|
move_to(sx, sy, sz + 0.500, 0.0); // Get to the starting point with no extrusion while bumped
|
|
@@ -626,11 +628,6 @@
|
626
|
628
|
const float e_pos_delta = line_length * g26_e_axis_feedrate * extrusion_multiplier;
|
627
|
629
|
|
628
|
630
|
un_retract_filament(destination);
|
629
|
|
-
|
630
|
|
- //if (ubl.g26_debug_flag) {
|
631
|
|
- // SERIAL_ECHOLNPGM(" doing printing move.");
|
632
|
|
- // debug_current_and_destination(PSTR("doing final move_to() inside print_line_from_here_to_there()"));
|
633
|
|
- //}
|
634
|
631
|
move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
635
|
632
|
}
|
636
|
633
|
|
|
@@ -754,7 +751,6 @@
|
754
|
751
|
}
|
755
|
752
|
|
756
|
753
|
bool exit_from_g26() {
|
757
|
|
- //strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
758
|
754
|
lcd_reset_alert_level();
|
759
|
755
|
lcd_setstatuspgm(PSTR("Leaving G26"));
|
760
|
756
|
while (ubl_lcd_clicked()) idle();
|