|
@@ -35,6 +35,7 @@
|
35
|
35
|
#include "temperature.h"
|
36
|
36
|
#include "UBL.h"
|
37
|
37
|
#include "ultralcd.h"
|
|
38
|
+//#include <avr/pgmspace.h>
|
38
|
39
|
|
39
|
40
|
#define EXTRUSION_MULTIPLIER 1.0 // This is too much clutter for the main Configuration.h file But
|
40
|
41
|
#define RETRACTION_MULTIPLIER 1.0 // some user have expressed an interest in being able to customize
|
|
@@ -127,6 +128,7 @@
|
127
|
128
|
extern bool code_value_bool();
|
128
|
129
|
extern bool code_has_value();
|
129
|
130
|
extern void lcd_init();
|
|
131
|
+ extern void lcd_setstatuspgm(const char* const message, uint8_t level);
|
130
|
132
|
#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob
|
131
|
133
|
bool prepare_move_to_destination_cartesian();
|
132
|
134
|
void line_to_destination();
|
|
@@ -152,9 +154,6 @@
|
152
|
154
|
// is currently retracted or not. This allows us to be
|
153
|
155
|
// less careful because mis-matched retractions and un-retractions
|
154
|
156
|
// won't leave us in a bad state.
|
155
|
|
- #if ENABLED(ULTRA_LCD)
|
156
|
|
- void lcd_setstatus(const char* message, bool persist);
|
157
|
|
- #endif
|
158
|
157
|
|
159
|
158
|
float valid_trig_angle(float);
|
160
|
159
|
mesh_index_pair find_closest_circle_to_print(float, float);
|
|
@@ -235,7 +234,7 @@
|
235
|
234
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
|
236
|
235
|
|
237
|
236
|
ubl_has_control_of_lcd_panel = true; // Take control of the LCD Panel!
|
238
|
|
- debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
|
|
237
|
+// debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
|
239
|
238
|
|
240
|
239
|
/**
|
241
|
240
|
* Declare and generate a sin() & cos() table to be used during the circle drawing. This will lighten
|
|
@@ -249,14 +248,18 @@
|
249
|
248
|
|
250
|
249
|
do {
|
251
|
250
|
|
252
|
|
- if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
253
|
|
- strcpy(lcd_status_message, "Mesh Validation Stopped."); // We can't do lcd_setstatus() without having it continue;
|
|
251
|
+ if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
254
|
252
|
#if ENABLED(ULTRA_LCD)
|
255
|
|
- lcd_setstatus("Mesh Validation Stopped.", true);
|
|
253
|
+ lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), (uint8_t) 99);
|
256
|
254
|
lcd_quick_feedback();
|
257
|
255
|
#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
|
|
256
|
+ while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
257
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
258
|
+ lcd_setstatuspgm(PSTR(" "), (uint8_t) 99);
|
|
259
|
+ }
|
|
260
|
+ while ( ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
|
261
|
+ idle(); // Encoder Wheel if that is why we are leaving
|
|
262
|
+ lcd_setstatuspgm(PSTR("Unpress Wheel "), (uint8_t) 99);
|
260
|
263
|
}
|
261
|
264
|
goto LEAVE;
|
262
|
265
|
}
|
|
@@ -341,16 +344,16 @@
|
341
|
344
|
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
342
|
345
|
#endif
|
343
|
346
|
|
344
|
|
- if (g26_debug_flag) {
|
345
|
|
- char ccc, *cptr, seg_msg[50], seg_num[10];
|
346
|
|
- strcpy(seg_msg, " segment: ");
|
347
|
|
- strcpy(seg_num, " \n");
|
348
|
|
- cptr = (char*) "01234567890ABCDEF????????";
|
349
|
|
- ccc = cptr[tmp_div_30];
|
350
|
|
- seg_num[1] = ccc;
|
351
|
|
- strcat(seg_msg, seg_num);
|
352
|
|
- debug_current_and_destination(seg_msg);
|
353
|
|
- }
|
|
347
|
+// if (g26_debug_flag) {
|
|
348
|
+// char ccc, *cptr, seg_msg[50], seg_num[10];
|
|
349
|
+// strcpy(seg_msg, " segment: ");
|
|
350
|
+// strcpy(seg_num, " \n");
|
|
351
|
+// cptr = (char*) "01234567890ABCDEF????????";
|
|
352
|
+// ccc = cptr[tmp_div_30];
|
|
353
|
+// seg_num[1] = ccc;
|
|
354
|
+// strcat(seg_msg, seg_num);
|
|
355
|
+// debug_current_and_destination(seg_msg);
|
|
356
|
+// }
|
354
|
357
|
|
355
|
358
|
print_line_from_here_to_there(x, y, layer_height, xe, ye, layer_height);
|
356
|
359
|
|
|
@@ -363,12 +366,12 @@
|
363
|
366
|
// }
|
364
|
367
|
|
365
|
368
|
// If the end point of the line is closer to the nozzle, we are going to
|
366
|
|
- debug_current_and_destination((char*)"Looking for lines to connect.");
|
|
369
|
+// debug_current_and_destination((char*)"Looking for lines to connect.");
|
367
|
370
|
look_for_lines_to_connect();
|
368
|
|
- debug_current_and_destination((char*)"Done with line connect.");
|
|
371
|
+// debug_current_and_destination((char*)"Done with line connect.");
|
369
|
372
|
}
|
370
|
373
|
|
371
|
|
- debug_current_and_destination((char*)"Done with current circle.");
|
|
374
|
+// debug_current_and_destination((char*)"Done with current circle.");
|
372
|
375
|
|
373
|
376
|
// If the end point of the line is closer to the nozzle, we are going to
|
374
|
377
|
|
|
@@ -376,23 +379,21 @@
|
376
|
379
|
while (location.x_index >= 0 && location.y_index >= 0);
|
377
|
380
|
|
378
|
381
|
LEAVE:
|
|
382
|
+ lcd_setstatuspgm(PSTR("Leaving G26 "), (uint8_t) 99);
|
379
|
383
|
|
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
|
|
- }
|
383
|
384
|
retract_filament();
|
384
|
385
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Raise the nozzle
|
385
|
386
|
|
386
|
|
- debug_current_and_destination((char*)"ready to do Z-Raise.");
|
|
387
|
+// debug_current_and_destination((char*)"ready to do Z-Raise.");
|
387
|
388
|
move_to( destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
|
388
|
|
- debug_current_and_destination((char*)"done doing Z-Raise.");
|
|
389
|
+// debug_current_and_destination((char*)"done doing Z-Raise.");
|
389
|
390
|
|
390
|
391
|
destination[X_AXIS] = x_pos; // Move back to the starting position
|
391
|
392
|
destination[Y_AXIS] = y_pos;
|
392
|
393
|
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
393
|
394
|
|
394
|
395
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Move back to the starting position
|
395
|
|
- debug_current_and_destination((char*)"done doing X/Y move.");
|
|
396
|
+// debug_current_and_destination((char*)"done doing X/Y move.");
|
396
|
397
|
|
397
|
398
|
ubl_has_control_of_lcd_panel = false; // Give back control of the LCD Panel!
|
398
|
399
|
|
|
@@ -402,7 +403,6 @@
|
402
|
403
|
#endif
|
403
|
404
|
thermalManager.setTargetHotend(0.0, 0);
|
404
|
405
|
}
|
405
|
|
- lcd_init(); // Some people's LCD Displays are locking up. This might help them
|
406
|
406
|
}
|
407
|
407
|
|
408
|
408
|
|
|
@@ -490,7 +490,7 @@
|
490
|
490
|
SERIAL_ECHOPGM(", ey=");
|
491
|
491
|
SERIAL_ECHO(ey);
|
492
|
492
|
SERIAL_ECHOLNPGM(")");
|
493
|
|
- debug_current_and_destination((char*)"Connecting horizontal line.");
|
|
493
|
+// debug_current_and_destination((char*)"Connecting horizontal line.");
|
494
|
494
|
}
|
495
|
495
|
|
496
|
496
|
print_line_from_here_to_there(sx, sy, layer_height, ex, ey, layer_height);
|
|
@@ -546,21 +546,19 @@
|
546
|
546
|
float feed_value;
|
547
|
547
|
static float last_z = -999.99;
|
548
|
548
|
|
549
|
|
-
|
550
|
|
-
|
551
|
549
|
bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
552
|
550
|
|
553
|
|
- if (g26_debug_flag) {
|
554
|
|
- SERIAL_ECHOPAIR("in move_to() has_xy_component:", (int)has_xy_component);
|
555
|
|
- SERIAL_EOL;
|
556
|
|
- }
|
|
551
|
+// if (g26_debug_flag) {
|
|
552
|
+// SERIAL_ECHOPAIR("in move_to() has_xy_component:", (int)has_xy_component);
|
|
553
|
+// SERIAL_EOL;
|
|
554
|
+// }
|
557
|
555
|
|
558
|
556
|
if (z != last_z) {
|
|
557
|
+// if (g26_debug_flag) {
|
|
558
|
+// SERIAL_ECHOPAIR("in move_to() changing Z to ", (int)z);
|
|
559
|
+// SERIAL_EOL;
|
|
560
|
+// }
|
559
|
561
|
|
560
|
|
- if (g26_debug_flag) {
|
561
|
|
- SERIAL_ECHOPAIR("in move_to() changing Z to ", (int)z);
|
562
|
|
- SERIAL_EOL;
|
563
|
|
- }
|
564
|
562
|
last_z = z;
|
565
|
563
|
feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate
|
566
|
564
|
|
|
@@ -574,8 +572,8 @@
|
574
|
572
|
stepper.synchronize();
|
575
|
573
|
set_destination_to_current();
|
576
|
574
|
|
577
|
|
- if (g26_debug_flag)
|
578
|
|
- debug_current_and_destination((char*)" in move_to() done with Z move");
|
|
575
|
+// if (g26_debug_flag)
|
|
576
|
+// debug_current_and_destination((char*)" in move_to() done with Z move");
|
579
|
577
|
}
|
580
|
578
|
|
581
|
579
|
// Check if X or Y is involved in the movement.
|
|
@@ -591,13 +589,13 @@
|
591
|
589
|
destination[Y_AXIS] = y;
|
592
|
590
|
destination[E_AXIS] += e_delta;
|
593
|
591
|
|
594
|
|
- if (g26_debug_flag)
|
595
|
|
- debug_current_and_destination((char*)" in move_to() doing last move");
|
|
592
|
+// if (g26_debug_flag)
|
|
593
|
+// debug_current_and_destination((char*)" in move_to() doing last move");
|
596
|
594
|
|
597
|
595
|
ubl_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
|
598
|
596
|
|
599
|
|
- if (g26_debug_flag)
|
600
|
|
- debug_current_and_destination((char*)" in move_to() after last move");
|
|
597
|
+// if (g26_debug_flag)
|
|
598
|
+// debug_current_and_destination((char*)" in move_to() after last move");
|
601
|
599
|
|
602
|
600
|
stepper.synchronize();
|
603
|
601
|
set_destination_to_current();
|
|
@@ -607,9 +605,9 @@
|
607
|
605
|
void retract_filament() {
|
608
|
606
|
if (!g26_retracted) { // Only retract if we are not already retracted!
|
609
|
607
|
g26_retracted = true;
|
610
|
|
- if (g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
|
|
608
|
+// if (g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
|
611
|
609
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], -1.0 * retraction_multiplier);
|
612
|
|
- if (g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
|
|
610
|
+// if (g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
|
613
|
611
|
}
|
614
|
612
|
}
|
615
|
613
|
|
|
@@ -617,7 +615,7 @@
|
617
|
615
|
if (g26_retracted) { // Only un-retract if we are retracted.
|
618
|
616
|
move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 1.2 * retraction_multiplier);
|
619
|
617
|
g26_retracted = false;
|
620
|
|
- if (g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
|
|
618
|
+// if (g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
|
621
|
619
|
}
|
622
|
620
|
}
|
623
|
621
|
|
|
@@ -656,8 +654,8 @@
|
656
|
654
|
// On very small lines we don't do the optimization because it just isn't worth it.
|
657
|
655
|
//
|
658
|
656
|
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(Line_Length)) {
|
659
|
|
- if (g26_debug_flag)
|
660
|
|
- SERIAL_ECHOLNPGM(" Reversing start and end of print_line_from_here_to_there()");
|
|
657
|
+// if (g26_debug_flag)
|
|
658
|
+// SERIAL_ECHOLNPGM(" Reversing start and end of print_line_from_here_to_there()");
|
661
|
659
|
print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
662
|
660
|
return;
|
663
|
661
|
}
|
|
@@ -666,8 +664,8 @@
|
666
|
664
|
|
667
|
665
|
if (dist_start > 2.0) {
|
668
|
666
|
retract_filament();
|
669
|
|
- if (g26_debug_flag)
|
670
|
|
- SERIAL_ECHOLNPGM(" filament retracted.");
|
|
667
|
+// if (g26_debug_flag)
|
|
668
|
+// SERIAL_ECHOLNPGM(" filament retracted.");
|
671
|
669
|
}
|
672
|
670
|
// If the end point of the line is closer to the nozzle, we are going to
|
673
|
671
|
move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion
|
|
@@ -679,10 +677,10 @@
|
679
|
677
|
un_retract_filament();
|
680
|
678
|
|
681
|
679
|
// If the end point of the line is closer to the nozzle, we are going to
|
682
|
|
- if (g26_debug_flag) {
|
683
|
|
- SERIAL_ECHOLNPGM(" doing printing move.");
|
684
|
|
- debug_current_and_destination((char*)"doing final move_to() inside print_line_from_here_to_there()");
|
685
|
|
- }
|
|
680
|
+// if (g26_debug_flag) {
|
|
681
|
+// SERIAL_ECHOLNPGM(" doing printing move.");
|
|
682
|
+// debug_current_and_destination((char*)"doing final move_to() inside print_line_from_here_to_there()");
|
|
683
|
+// }
|
686
|
684
|
move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion
|
687
|
685
|
|
688
|
686
|
// If the end point of the line is closer to the nozzle, we are going to
|
|
@@ -830,16 +828,16 @@
|
830
|
828
|
#if HAS_TEMP_BED
|
831
|
829
|
#if ENABLED(ULTRA_LCD)
|
832
|
830
|
if (bed_temp > 25) {
|
833
|
|
- lcd_setstatus("G26 Heating Bed.", true);
|
|
831
|
+ lcd_setstatuspgm(PSTR("G26 Heating Bed."), (uint8_t) 99);
|
834
|
832
|
lcd_quick_feedback();
|
835
|
833
|
#endif
|
836
|
834
|
ubl_has_control_of_lcd_panel = true;
|
837
|
835
|
thermalManager.setTargetBed(bed_temp);
|
838
|
836
|
while (abs(thermalManager.degBed() - bed_temp) > 3) {
|
839
|
837
|
if (ubl_lcd_clicked()) {
|
840
|
|
- strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
841
|
|
- lcd_setstatus("Leaving G26", true); // Now we do it right.
|
842
|
|
- while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
|
838
|
+ strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
|
839
|
+ lcd_setstatuspgm(PSTR("Leaving G26"), (uint8_t) 99); // Now we do it right.
|
|
840
|
+ while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
843
|
841
|
idle();
|
844
|
842
|
return UBL_ERR;
|
845
|
843
|
}
|
|
@@ -847,7 +845,7 @@
|
847
|
845
|
}
|
848
|
846
|
#if ENABLED(ULTRA_LCD)
|
849
|
847
|
}
|
850
|
|
- lcd_setstatus("G26 Heating Nozzle.", true);
|
|
848
|
+ lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), (uint8_t) 99);
|
851
|
849
|
lcd_quick_feedback();
|
852
|
850
|
#endif
|
853
|
851
|
#endif
|
|
@@ -856,9 +854,9 @@
|
856
|
854
|
thermalManager.setTargetHotend(hotend_temp, 0);
|
857
|
855
|
while (abs(thermalManager.degHotend(0) - hotend_temp) > 3) {
|
858
|
856
|
if (ubl_lcd_clicked()) {
|
859
|
|
- strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatus() without having it continue;
|
860
|
|
- lcd_setstatus("Leaving G26", true); // Now we do it right.
|
861
|
|
- while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
|
857
|
+ strcpy(lcd_status_message, "Leaving G26"); // We can't do lcd_setstatuspgm() without having it continue;
|
|
858
|
+ lcd_setstatuspgm(PSTR("Leaving G26"), (uint8_t) 99); // Now we do it right.
|
|
859
|
+ while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
862
|
860
|
idle();
|
863
|
861
|
return UBL_ERR;
|
864
|
862
|
}
|
|
@@ -866,7 +864,7 @@
|
866
|
864
|
}
|
867
|
865
|
|
868
|
866
|
#if ENABLED(ULTRA_LCD)
|
869
|
|
- lcd_setstatus("", true);
|
|
867
|
+ lcd_setstatuspgm(PSTR(""), (uint8_t) 99);
|
870
|
868
|
lcd_quick_feedback();
|
871
|
869
|
#endif
|
872
|
870
|
return UBL_OK;
|
|
@@ -879,7 +877,7 @@
|
879
|
877
|
float Total_Prime = 0.0;
|
880
|
878
|
|
881
|
879
|
if (prime_flag == -1) { // The user wants to control how much filament gets purged
|
882
|
|
- lcd_setstatus("User-Controlled Prime", true);
|
|
880
|
+ lcd_setstatuspgm(PSTR("User-Controlled Prime"), (uint8_t) 99);
|
883
|
881
|
chirp_at_user();
|
884
|
882
|
|
885
|
883
|
set_destination_to_current();
|
|
@@ -908,19 +906,19 @@
|
908
|
906
|
idle();
|
909
|
907
|
}
|
910
|
908
|
|
911
|
|
- strcpy(lcd_status_message, "Done Priming"); // We can't do lcd_setstatus() without having it continue;
|
|
909
|
+ strcpy(lcd_status_message, "Done Priming"); // We can't do lcd_setstatuspgm() without having it continue;
|
912
|
910
|
// So... We cheat to get a message up.
|
913
|
911
|
while (ubl_lcd_clicked()) // Debounce Encoder Wheel
|
914
|
912
|
idle();
|
915
|
913
|
|
916
|
914
|
#if ENABLED(ULTRA_LCD)
|
917
|
|
- lcd_setstatus("Done Priming", true); // Now we do it right.
|
|
915
|
+ lcd_setstatuspgm(PSTR("Done Priming"), (uint8_t) 99);
|
918
|
916
|
lcd_quick_feedback();
|
919
|
917
|
#endif
|
920
|
918
|
}
|
921
|
919
|
else {
|
922
|
920
|
#if ENABLED(ULTRA_LCD)
|
923
|
|
- lcd_setstatus("Fixed Length Prime.", true);
|
|
921
|
+ lcd_setstatuspgm(PSTR("Fixed Length Prime."), (uint8_t) 99);
|
924
|
922
|
lcd_quick_feedback();
|
925
|
923
|
#endif
|
926
|
924
|
set_destination_to_current();
|