|
@@ -199,6 +199,7 @@
|
199
|
199
|
set_current_to_destination();
|
200
|
200
|
}
|
201
|
201
|
|
|
202
|
+ ubl_has_control_of_lcd_panel = true; // Take control of the LCD Panel!
|
202
|
203
|
if (turn_on_heaters()) // Turn on the heaters, leave the command if anything
|
203
|
204
|
goto LEAVE; // has gone wrong.
|
204
|
205
|
|
|
@@ -233,19 +234,30 @@
|
233
|
234
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
|
234
|
235
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
|
235
|
236
|
|
236
|
|
- ubl_has_control_of_lcd_panel++; // Take control of the LCD Panel!
|
|
237
|
+ ubl_has_control_of_lcd_panel = true; // Take control of the LCD Panel!
|
237
|
238
|
debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
|
238
|
239
|
|
239
|
|
- wait_for_user = true;
|
|
240
|
+ /**
|
|
241
|
+ * Declare and generate a sin() & cos() table to be used during the circle drawing. This will lighten
|
|
242
|
+ * the CPU load and make the arc drawing faster and more smooth
|
|
243
|
+ */
|
|
244
|
+ float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
|
|
245
|
+ for (i = 0; i <= 360 / 30; i++) {
|
|
246
|
+ cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
|
|
247
|
+ sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
|
|
248
|
+ }
|
240
|
249
|
|
241
|
250
|
do {
|
242
|
251
|
|
243
|
|
- if (!wait_for_user) { // Check if the user wants to stop the Mesh Validation
|
|
252
|
+ if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
244
|
253
|
strcpy(lcd_status_message, "Mesh Validation Stopped."); // We can't do lcd_setstatus() without having it continue;
|
245
|
254
|
#if ENABLED(ULTRA_LCD)
|
246
|
255
|
lcd_setstatus("Mesh Validation Stopped.", true);
|
247
|
256
|
lcd_quick_feedback();
|
248
|
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
|
+ }
|
249
|
261
|
goto LEAVE;
|
250
|
262
|
}
|
251
|
263
|
|
|
@@ -309,16 +321,6 @@
|
309
|
321
|
end_angle = 360.0;
|
310
|
322
|
}
|
311
|
323
|
|
312
|
|
- /**
|
313
|
|
- * Declare and generate a sin() & cos() table to be used during the circle drawing. This will lighten
|
314
|
|
- * the CPU load and make the arc drawing faster and more smooth
|
315
|
|
- */
|
316
|
|
- float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
|
317
|
|
- for (i = 0; i <= 360 / 30; i++) {
|
318
|
|
- cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
|
319
|
|
- sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
|
320
|
|
- }
|
321
|
|
-
|
322
|
324
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
323
|
325
|
int tmp_div_30 = tmp / 30.0;
|
324
|
326
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
|
@@ -351,13 +353,16 @@
|
351
|
353
|
}
|
352
|
354
|
|
353
|
355
|
print_line_from_here_to_there(x, y, layer_height, xe, ye, layer_height);
|
|
356
|
+
|
354
|
357
|
}
|
355
|
|
- lcd_init_counter++;
|
356
|
|
- if (lcd_init_counter > 10) {
|
357
|
|
- lcd_init_counter = 0;
|
358
|
|
- lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
359
|
|
- }
|
|
358
|
+// lcd_init_counter++;
|
|
359
|
+// if (lcd_init_counter > 10) {
|
|
360
|
+// lcd_init_counter = 0;
|
|
361
|
+// lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
|
362
|
+// ubl_has_control_of_lcd_panel = true; // Make sure UBL still is controlling the LCD Panel
|
|
363
|
+// }
|
360
|
364
|
|
|
365
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
361
|
366
|
debug_current_and_destination((char*)"Looking for lines to connect.");
|
362
|
367
|
look_for_lines_to_connect();
|
363
|
368
|
debug_current_and_destination((char*)"Done with line connect.");
|
|
@@ -365,21 +370,24 @@
|
365
|
370
|
|
366
|
371
|
debug_current_and_destination((char*)"Done with current circle.");
|
367
|
372
|
|
|
373
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
|
374
|
+
|
368
|
375
|
}
|
369
|
376
|
while (location.x_index >= 0 && location.y_index >= 0);
|
370
|
377
|
|
371
|
378
|
LEAVE:
|
372
|
379
|
|
373
|
|
- wait_for_user = false;
|
374
|
|
-
|
|
380
|
+ while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
381
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
382
|
+ }
|
375
|
383
|
retract_filament();
|
376
|
384
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Raise the nozzle
|
377
|
385
|
|
378
|
386
|
debug_current_and_destination((char*)"ready to do Z-Raise.");
|
379
|
|
- move_to( destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
|
|
387
|
+ move_to( destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
|
380
|
388
|
debug_current_and_destination((char*)"done doing Z-Raise.");
|
381
|
389
|
|
382
|
|
- destination[X_AXIS] = x_pos; // Move back to the starting position
|
|
390
|
+ destination[X_AXIS] = x_pos; // Move back to the starting position
|
383
|
391
|
destination[Y_AXIS] = y_pos;
|
384
|
392
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
385
|
393
|
|
|
@@ -538,6 +546,8 @@
|
538
|
546
|
float feed_value;
|
539
|
547
|
static float last_z = -999.99;
|
540
|
548
|
|
|
549
|
+
|
|
550
|
+
|
541
|
551
|
bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
542
|
552
|
|
543
|
553
|
if (g26_debug_flag) {
|
|
@@ -591,6 +601,7 @@
|
591
|
601
|
|
592
|
602
|
stepper.synchronize();
|
593
|
603
|
set_destination_to_current();
|
|
604
|
+
|
594
|
605
|
}
|
595
|
606
|
|
596
|
607
|
void retract_filament() {
|
|
@@ -658,16 +669,23 @@
|
658
|
669
|
if (g26_debug_flag)
|
659
|
670
|
SERIAL_ECHOLNPGM(" filament retracted.");
|
660
|
671
|
}
|
|
672
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
661
|
673
|
move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion
|
662
|
674
|
|
|
675
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
|
676
|
+
|
663
|
677
|
float e_pos_delta = Line_Length * g26_e_axis_feedrate * extrusion_multiplier;
|
664
|
678
|
|
665
|
679
|
un_retract_filament();
|
|
680
|
+
|
|
681
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
666
|
682
|
if (g26_debug_flag) {
|
667
|
683
|
SERIAL_ECHOLNPGM(" doing printing move.");
|
668
|
684
|
debug_current_and_destination((char*)"doing final move_to() inside print_line_from_here_to_there()");
|
669
|
685
|
}
|
670
|
686
|
move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
|
687
|
+
|
|
688
|
+ // If the end point of the line is closer to the nozzle, we are going to
|
671
|
689
|
}
|
672
|
690
|
|
673
|
691
|
/**
|
|
@@ -815,18 +833,18 @@
|
815
|
833
|
lcd_setstatus("G26 Heating Bed.", true);
|
816
|
834
|
lcd_quick_feedback();
|
817
|
835
|
#endif
|
818
|
|
- ubl_has_control_of_lcd_panel++;
|
|
836
|
+ ubl_has_control_of_lcd_panel = true;
|
819
|
837
|
thermalManager.setTargetBed(bed_temp);
|
820
|
|
- wait_for_user = true;
|
821
|
838
|
while (abs(thermalManager.degBed() - bed_temp) > 3) {
|
822
|
|
- if (!wait_for_user) {
|
|
839
|
+ if (ubl_lcd_clicked()) {
|
823
|
840
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
824
|
841
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
842
|
+ while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
|
843
|
+ idle();
|
825
|
844
|
return UBL_ERR;
|
826
|
845
|
}
|
827
|
846
|
idle();
|
828
|
847
|
}
|
829
|
|
- wait_for_user = false;
|
830
|
848
|
#if ENABLED(ULTRA_LCD)
|
831
|
849
|
}
|
832
|
850
|
lcd_setstatus("G26 Heating Nozzle.", true);
|
|
@@ -836,16 +854,16 @@
|
836
|
854
|
|
837
|
855
|
// Start heating the nozzle and wait for it to reach temperature.
|
838
|
856
|
thermalManager.setTargetHotend(hotend_temp, 0);
|
839
|
|
- wait_for_user = true;
|
840
|
857
|
while (abs(thermalManager.degHotend(0) - hotend_temp) > 3) {
|
841
|
|
- if (!wait_for_user) {
|
|
858
|
+ if (ubl_lcd_clicked()) {
|
842
|
859
|
strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
843
|
860
|
lcd_setstatus("Leaving G26", true); // Now we do it right.
|
|
861
|
+ while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
|
862
|
+ idle();
|
844
|
863
|
return UBL_ERR;
|
845
|
864
|
}
|
846
|
865
|
idle();
|
847
|
866
|
}
|
848
|
|
- wait_for_user = false;
|
849
|
867
|
|
850
|
868
|
#if ENABLED(ULTRA_LCD)
|
851
|
869
|
lcd_setstatus("", true);
|
|
@@ -869,9 +887,7 @@
|
869
|
887
|
un_retract_filament(); // Lets make sure the G26 command doesn't think the filament is
|
870
|
888
|
// retracted(). We are here because we want to prime the nozzle.
|
871
|
889
|
// So let's just unretract just to be sure.
|
872
|
|
-
|
873
|
|
- wait_for_user = true;
|
874
|
|
- while (wait_for_user) {
|
|
890
|
+ while (!ubl_lcd_clicked()) {
|
875
|
891
|
chirp_at_user();
|
876
|
892
|
destination[E_AXIS] += 0.25;
|
877
|
893
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
|
@@ -894,9 +910,10 @@
|
894
|
910
|
|
895
|
911
|
strcpy(lcd_status_message, "Done Priming"); // We can't do lcd_setstatus() without having it continue;
|
896
|
912
|
// So... We cheat to get a message up.
|
|
913
|
+ while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
|
914
|
+ idle();
|
897
|
915
|
|
898
|
916
|
#if ENABLED(ULTRA_LCD)
|
899
|
|
- ubl_has_control_of_lcd_panel = false;
|
900
|
917
|
lcd_setstatus("Done Priming", true); // Now we do it right.
|
901
|
918
|
lcd_quick_feedback();
|
902
|
919
|
#endif
|
|
@@ -917,6 +934,7 @@
|
917
|
934
|
set_destination_to_current();
|
918
|
935
|
retract_filament();
|
919
|
936
|
}
|
|
937
|
+
|
920
|
938
|
return UBL_OK;
|
921
|
939
|
}
|
922
|
940
|
|