|
@@ -586,8 +586,8 @@ void GcodeSuite::G26() {
|
586
|
586
|
|
587
|
587
|
if (parser.seenval('B')) {
|
588
|
588
|
g26_bed_temp = parser.value_celsius();
|
589
|
|
- if (!WITHIN(g26_bed_temp, 15, 140)) {
|
590
|
|
- SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
|
|
589
|
+ if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) {
|
|
590
|
+ SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible (40-140C).");
|
591
|
591
|
return;
|
592
|
592
|
}
|
593
|
593
|
}
|
|
@@ -737,14 +737,15 @@ void GcodeSuite::G26() {
|
737
|
737
|
|
738
|
738
|
/**
|
739
|
739
|
* Pre-generate radius offset values at 30 degree intervals to reduce CPU load.
|
740
|
|
- * All angles are offset by 15 degrees to allow for a smaller table.
|
741
|
740
|
*/
|
742
|
|
- #define A_CNT ((360 / 30) / 2)
|
743
|
|
- #define _COS(A) (trig_table[((A + A_CNT * 8) % A_CNT)] * (A >= A_CNT ? -1 : 1))
|
|
741
|
+
|
|
742
|
+ #define A_CNT ((360 / 30) / 2) // must be a multiple of 2 for _COS() and _SIN() macro to work correctly!
|
|
743
|
+ #define NEGATION_of_COS_TABLE(A) (((A + A_CNT * 16) % (A_CNT * 2)) >= A_CNT ? -1 : 1)
|
|
744
|
+ #define _COS(A) (trig_table[(A + A_CNT * 16) % A_CNT] * NEGATION_of_COS_TABLE(A))
|
744
|
745
|
#define _SIN(A) (-_COS((A + A_CNT / 2) % (A_CNT * 2)))
|
745
|
746
|
float trig_table[A_CNT];
|
746
|
747
|
for (uint8_t i = 0; i < A_CNT; i++)
|
747
|
|
- trig_table[i] = INTERSECTION_CIRCLE_RADIUS * cos(RADIANS(i * 30 + 15));
|
|
748
|
+ trig_table[i] = INTERSECTION_CIRCLE_RADIUS * cos(RADIANS(i * 30));
|
748
|
749
|
|
749
|
750
|
mesh_index_pair location;
|
750
|
751
|
do {
|
|
@@ -762,32 +763,26 @@ void GcodeSuite::G26() {
|
762
|
763
|
// Determine where to start and end the circle,
|
763
|
764
|
// which is always drawn counter-clockwise.
|
764
|
765
|
const uint8_t xi = location.x_index, yi = location.y_index;
|
765
|
|
- const bool f = yi == 0, r = xi == GRID_MAX_POINTS_X - 1, b = yi == GRID_MAX_POINTS_Y - 1;
|
766
|
|
- int8_t start_ind = -2, end_ind = 10; // Assume a full circle (from 4:30 to 4:30)
|
767
|
|
- if (xi == 0) { // Left edge? Just right half.
|
768
|
|
- start_ind = f ? 0 : -3; // 05:30 (02:30 for front-left)
|
769
|
|
- end_ind = b ? -1 : 2; // 12:30 (03:30 for back-left)
|
770
|
|
- }
|
771
|
|
- else if (r) { // Right edge? Just left half.
|
772
|
|
- start_ind = f ? 5 : 3; // 11:30 (09:30 for front-right)
|
773
|
|
- end_ind = b ? 6 : 8; // 06:30 (08:30 for back-right)
|
|
766
|
+ const bool f = yi == 0, r = xi >= GRID_MAX_POINTS_X - 1, b = yi >= GRID_MAX_POINTS_Y - 1;
|
|
767
|
+ int8_t start_ind = -2, end_ind = 9; // Assume a full circle (from 5:00 to 5:00)
|
|
768
|
+ if (xi == 0) { // Left edge? Just right half.
|
|
769
|
+ start_ind = f ? 0 : -3; // 03:00 to 12:00 for front-left
|
|
770
|
+ end_ind = b ? 0 : 2; // 06:00 to 03:00 for back-left
|
774
|
771
|
}
|
775
|
|
- else if (f) { // Front edge? Just back half.
|
776
|
|
- start_ind = 0; // 02:30
|
777
|
|
- end_ind = 5; // 09:30
|
|
772
|
+ else if (r) { // Right edge? Just left half.
|
|
773
|
+ start_ind = b ? 6 : 3; // 12:00 to 09:00 for front-right
|
|
774
|
+ end_ind = f ? 5 : 8; // 09:00 to 06:00 for back-right
|
778
|
775
|
}
|
779
|
|
- else if (b) { // Back edge? Just front half.
|
780
|
|
- start_ind = 6; // 08:30
|
781
|
|
- end_ind = 11; // 03:30
|
|
776
|
+ else if (f) { // Front edge? Just back half.
|
|
777
|
+ start_ind = 0; // 03:00
|
|
778
|
+ end_ind = 5; // 09:00
|
782
|
779
|
}
|
783
|
|
- if (g26_debug_flag) {
|
784
|
|
- SERIAL_ECHOPAIR(" Doing circle at: (xi=", xi);
|
785
|
|
- SERIAL_ECHOPAIR(", yi=", yi);
|
786
|
|
- SERIAL_CHAR(')');
|
787
|
|
- SERIAL_EOL();
|
|
780
|
+ else if (b) { // Back edge? Just front half.
|
|
781
|
+ start_ind = 6; // 09:00
|
|
782
|
+ end_ind = 11; // 03:00
|
788
|
783
|
}
|
789
|
784
|
|
790
|
|
- for (int8_t ind = start_ind; ind < end_ind; ind++) {
|
|
785
|
+ for (int8_t ind = start_ind; ind <= end_ind; ind++) {
|
791
|
786
|
|
792
|
787
|
#if ENABLED(NEWPANEL)
|
793
|
788
|
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
|
@@ -808,16 +803,6 @@ void GcodeSuite::G26() {
|
808
|
803
|
ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
809
|
804
|
#endif
|
810
|
805
|
|
811
|
|
- //if (g26_debug_flag) {
|
812
|
|
- // char ccc, *cptr, seg_msg[50], seg_num[10];
|
813
|
|
- // strcpy(seg_msg, " segment: ");
|
814
|
|
- // strcpy(seg_num, " \n");
|
815
|
|
- // cptr = (char*) "01234567890ABCDEF????????";
|
816
|
|
- // ccc = cptr[tmp_div_30];
|
817
|
|
- // seg_num[1] = ccc;
|
818
|
|
- // strcat(seg_msg, seg_num);
|
819
|
|
- // debug_current_and_destination(seg_msg);
|
820
|
|
- //}
|
821
|
806
|
|
822
|
807
|
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
|
823
|
808
|
MYSERIAL0.flush(); // Prevent host M105 buffer overrun.
|