|
@@ -50,11 +50,10 @@
|
50
|
50
|
extern bool code_has_value();
|
51
|
51
|
extern float probe_pt(float x, float y, bool, int);
|
52
|
52
|
extern bool set_probe_deployed(bool);
|
53
|
|
- void smart_fill_mesh();
|
|
53
|
+ void smart_fill_mesh();
|
54
|
54
|
|
55
|
55
|
bool ProbeStay = true;
|
56
|
56
|
|
57
|
|
-
|
58
|
57
|
#define SIZE_OF_LITTLE_RAISE 0
|
59
|
58
|
#define BIG_RAISE_NOT_NEEDED 0
|
60
|
59
|
extern void lcd_quick_feedback();
|
|
@@ -189,13 +188,13 @@
|
189
|
188
|
* P3 Phase 3 Fill the unpopulated regions of the Mesh with a fixed value. There are two different paths the
|
190
|
189
|
* user can go down. If the user specifies the value using the C parameter, the closest invalid
|
191
|
190
|
* mesh points to the nozzle will be filled. The user can specify a repeat count using the R
|
192
|
|
- * parameter with the C version of the command.
|
|
191
|
+ * parameter with the C version of the command.
|
193
|
192
|
*
|
194
|
|
- * A second version of the fill command is available if no C constant is specified. Not
|
|
193
|
+ * A second version of the fill command is available if no C constant is specified. Not
|
195
|
194
|
* specifying a C constant will invoke the 'Smart Fill' algorithm. The G29 P3 command will search
|
196
|
195
|
* from the edges of the mesh inward looking for invalid mesh points. It will look at the next
|
197
|
196
|
* several mesh points to determine if the print bed is sloped up or down. If the bed is sloped
|
198
|
|
- * upward from the invalid mesh point, it will be replaced with the value of the nearest mesh point.
|
|
197
|
+ * upward from the invalid mesh point, it will be replaced with the value of the nearest mesh point.
|
199
|
198
|
* If the bed is sloped downward from the invalid mesh point, it will be replaced with a value that
|
200
|
199
|
* puts all three points in a line. The second version of the G29 P3 command is a quick, easy and
|
201
|
200
|
* usually safe way to populate the unprobed regions of your mesh so you can continue to the G26
|
|
@@ -336,7 +335,7 @@
|
336
|
335
|
repetition_cnt = code_has_value() ? code_value_int() : 1;
|
337
|
336
|
while (repetition_cnt--) {
|
338
|
337
|
if (cnt > 20) { cnt = 0; idle(); }
|
339
|
|
- const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, x_pos, y_pos, USE_NOZZLE_AS_REFERENCE, NULL, false);
|
|
338
|
+ const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, x_pos, y_pos, USE_NOZZLE_AS_REFERENCE, NULL, false);
|
340
|
339
|
if (location.x_index < 0) {
|
341
|
340
|
SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
|
342
|
341
|
break; // No more invalid Mesh Points to populate
|
|
@@ -460,7 +459,7 @@
|
460
|
459
|
|
461
|
460
|
case 3: {
|
462
|
461
|
//
|
463
|
|
- // Populate invalid Mesh areas. Two choices are available to the user. The user can
|
|
462
|
+ // Populate invalid Mesh areas. Two choices are available to the user. The user can
|
464
|
463
|
// specify the constant to be used with a C # paramter. Or the user can allow the G29 P3 command to
|
465
|
464
|
// apply a 'reasonable' constant to the invalid mesh point. Some caution and scrutiny should be used
|
466
|
465
|
// on either of these paths!
|
|
@@ -811,9 +810,9 @@
|
811
|
810
|
* Z is negative, we need to invert the sign of all components of the vector
|
812
|
811
|
*/
|
813
|
812
|
if ( normal.z < 0.0 ) {
|
814
|
|
- normal.x = -normal.x;
|
815
|
|
- normal.y = -normal.y;
|
816
|
|
- normal.z = -normal.z;
|
|
813
|
+ normal.x = -normal.x;
|
|
814
|
+ normal.y = -normal.y;
|
|
815
|
+ normal.z = -normal.z;
|
817
|
816
|
}
|
818
|
817
|
|
819
|
818
|
rotation = matrix_3x3::create_look_at( vector_3( normal.x, normal.y, 1));
|
|
@@ -863,7 +862,7 @@
|
863
|
862
|
for (i = 0; i < GRID_MAX_POINTS_X; i++) {
|
864
|
863
|
for (j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
865
|
864
|
float x_tmp, y_tmp, z_tmp;
|
866
|
|
- x_tmp = pgm_read_float(ubl.mesh_index_to_xpos[i]);
|
|
865
|
+ x_tmp = pgm_read_float(ubl.mesh_index_to_xpos[i]);
|
867
|
866
|
y_tmp = pgm_read_float(ubl.mesh_index_to_ypos[j]);
|
868
|
867
|
z_tmp = ubl.z_values[i][j];
|
869
|
868
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -947,7 +946,7 @@
|
947
|
946
|
float last_x = -9999.99, last_y = -9999.99;
|
948
|
947
|
mesh_index_pair location;
|
949
|
948
|
do {
|
950
|
|
- location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false);
|
|
949
|
+ location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false);
|
951
|
950
|
// It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
|
952
|
951
|
if (location.x_index < 0 && location.y_index < 0) continue;
|
953
|
952
|
|
|
@@ -1415,7 +1414,7 @@
|
1415
|
1414
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
1416
|
1415
|
do_blocking_move_to_xy(lx, ly);
|
1417
|
1416
|
do {
|
1418
|
|
- location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false);
|
|
1417
|
+ location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false);
|
1419
|
1418
|
// It doesn't matter if the probe can not reach this
|
1420
|
1419
|
// location. This is a manual edit of the Mesh Point.
|
1421
|
1420
|
if (location.x_index < 0 && location.y_index < 0) continue; // abort if we can't find any more points.
|
|
@@ -1500,7 +1499,7 @@
|
1500
|
1499
|
}
|
1501
|
1500
|
|
1502
|
1501
|
//
|
1503
|
|
- // The routine provides the 'Smart Fill' capability. It scans from the
|
|
1502
|
+ // The routine provides the 'Smart Fill' capability. It scans from the
|
1504
|
1503
|
// outward edges of the mesh towards the center. If it finds an invalid
|
1505
|
1504
|
// location, it uses the next two points (assumming they are valid) to
|
1506
|
1505
|
// calculate a 'reasonable' value for the unprobed mesh point.
|
|
@@ -1510,14 +1509,14 @@
|
1510
|
1509
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Bottom of the mesh looking up
|
1511
|
1510
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y-2; y++) {
|
1512
|
1511
|
if (isnan(ubl.z_values[x][y])) {
|
1513
|
|
- if (isnan(ubl.z_values[x][y+1])) // we only deal with the first NAN next to a block of
|
|
1512
|
+ if (isnan(ubl.z_values[x][y+1])) // we only deal with the first NAN next to a block of
|
1514
|
1513
|
continue; // good numbers. we want 2 good numbers to extrapolate off of.
|
1515
|
|
- if (isnan(ubl.z_values[x][y+2]))
|
1516
|
|
- continue;
|
|
1514
|
+ if (isnan(ubl.z_values[x][y+2]))
|
|
1515
|
+ continue;
|
1517
|
1516
|
if (ubl.z_values[x][y+1] < ubl.z_values[x][y+2]) // The bed is angled down near this edge. So to be safe, we
|
1518
|
1517
|
ubl.z_values[x][y] = ubl.z_values[x][y+1]; // use the closest value, which is probably a little too high
|
1519
|
1518
|
else {
|
1520
|
|
- diff = ubl.z_values[x][y+1] - ubl.z_values[x][y+2]; // The bed is angled up near this edge. So we will use the closest
|
|
1519
|
+ diff = ubl.z_values[x][y+1] - ubl.z_values[x][y+2]; // The bed is angled up near this edge. So we will use the closest
|
1521
|
1520
|
ubl.z_values[x][y] = ubl.z_values[x][y+1] + diff; // height and add in the difference between that and the next point
|
1522
|
1521
|
}
|
1523
|
1522
|
break;
|
|
@@ -1527,14 +1526,14 @@
|
1527
|
1526
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Top of the mesh looking down
|
1528
|
1527
|
for (uint8_t y=GRID_MAX_POINTS_Y-1; y>=1; y--) {
|
1529
|
1528
|
if (isnan(ubl.z_values[x][y])) {
|
1530
|
|
- if (isnan(ubl.z_values[x][y-1])) // we only deal with the first NAN next to a block of
|
|
1529
|
+ if (isnan(ubl.z_values[x][y-1])) // we only deal with the first NAN next to a block of
|
1531
|
1530
|
continue; // good numbers. we want 2 good numbers to extrapolate off of.
|
1532
|
|
- if (isnan(ubl.z_values[x][y-2]))
|
1533
|
|
- continue;
|
|
1531
|
+ if (isnan(ubl.z_values[x][y-2]))
|
|
1532
|
+ continue;
|
1534
|
1533
|
if (ubl.z_values[x][y-1] < ubl.z_values[x][y-2]) // The bed is angled down near this edge. So to be safe, we
|
1535
|
1534
|
ubl.z_values[x][y] = ubl.z_values[x][y-1]; // use the closest value, which is probably a little too high
|
1536
|
1535
|
else {
|
1537
|
|
- diff = ubl.z_values[x][y-1] - ubl.z_values[x][y-2]; // The bed is angled up near this edge. So we will use the closest
|
|
1536
|
+ diff = ubl.z_values[x][y-1] - ubl.z_values[x][y-2]; // The bed is angled up near this edge. So we will use the closest
|
1538
|
1537
|
ubl.z_values[x][y] = ubl.z_values[x][y-1] + diff; // height and add in the difference between that and the next point
|
1539
|
1538
|
}
|
1540
|
1539
|
break;
|
|
@@ -1544,14 +1543,14 @@
|
1544
|
1543
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
|
1545
|
1544
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X-2; x++) { // Left side of the mesh looking right
|
1546
|
1545
|
if (isnan(ubl.z_values[x][y])) {
|
1547
|
|
- if (isnan(ubl.z_values[x+1][y])) // we only deal with the first NAN next to a block of
|
|
1546
|
+ if (isnan(ubl.z_values[x+1][y])) // we only deal with the first NAN next to a block of
|
1548
|
1547
|
continue; // good numbers. we want 2 good numbers to extrapolate off of.
|
1549
|
|
- if (isnan(ubl.z_values[x+2][y]))
|
1550
|
|
- continue;
|
|
1548
|
+ if (isnan(ubl.z_values[x+2][y]))
|
|
1549
|
+ continue;
|
1551
|
1550
|
if (ubl.z_values[x+1][y] < ubl.z_values[x+2][y]) // The bed is angled down near this edge. So to be safe, we
|
1552
|
1551
|
ubl.z_values[x][y] = ubl.z_values[x][y+1]; // use the closest value, which is probably a little too high
|
1553
|
1552
|
else {
|
1554
|
|
- diff = ubl.z_values[x+1][y] - ubl.z_values[x+2][y]; // The bed is angled up near this edge. So we will use the closest
|
|
1553
|
+ diff = ubl.z_values[x+1][y] - ubl.z_values[x+2][y]; // The bed is angled up near this edge. So we will use the closest
|
1555
|
1554
|
ubl.z_values[x][y] = ubl.z_values[x+1][y] + diff; // height and add in the difference between that and the next point
|
1556
|
1555
|
}
|
1557
|
1556
|
break;
|
|
@@ -1561,18 +1560,18 @@
|
1561
|
1560
|
for (uint8_t y=0; y < GRID_MAX_POINTS_Y; y++) {
|
1562
|
1561
|
for (uint8_t x=GRID_MAX_POINTS_X-1; x>=1; x--) { // Right side of the mesh looking left
|
1563
|
1562
|
if (isnan(ubl.z_values[x][y])) {
|
1564
|
|
- if (isnan(ubl.z_values[x-1][y])) // we only deal with the first NAN next to a block of
|
|
1563
|
+ if (isnan(ubl.z_values[x-1][y])) // we only deal with the first NAN next to a block of
|
1565
|
1564
|
continue; // good numbers. we want 2 good numbers to extrapolate off of.
|
1566
|
|
- if (isnan(ubl.z_values[x-2][y]))
|
1567
|
|
- continue;
|
|
1565
|
+ if (isnan(ubl.z_values[x-2][y]))
|
|
1566
|
+ continue;
|
1568
|
1567
|
if (ubl.z_values[x-1][y] < ubl.z_values[x-2][y]) // The bed is angled down near this edge. So to be safe, we
|
1569
|
1568
|
ubl.z_values[x][y] = ubl.z_values[x-1][y]; // use the closest value, which is probably a little too high
|
1570
|
1569
|
else {
|
1571
|
|
- diff = ubl.z_values[x-1][y] - ubl.z_values[x-2][y]; // The bed is angled up near this edge. So we will use the closest
|
|
1570
|
+ diff = ubl.z_values[x-1][y] - ubl.z_values[x-2][y]; // The bed is angled up near this edge. So we will use the closest
|
1572
|
1571
|
ubl.z_values[x][y] = ubl.z_values[x-1][y] + diff; // height and add in the difference between that and the next point
|
1573
|
1572
|
}
|
1574
|
1573
|
break;
|
1575
|
|
- }
|
|
1574
|
+ }
|
1576
|
1575
|
}
|
1577
|
1576
|
}
|
1578
|
1577
|
}
|
|
@@ -1599,7 +1598,7 @@
|
1599
|
1598
|
for(ix=0; ix<grid_size; ix++) {
|
1600
|
1599
|
x = ((float)x_min) + ix*dx;
|
1601
|
1600
|
for(iy=0; iy<grid_size; iy++) {
|
1602
|
|
- if (zig_zag)
|
|
1601
|
+ if (zig_zag)
|
1603
|
1602
|
y = ((float)y_min) + (grid_size-iy-1)*dy;
|
1604
|
1603
|
else
|
1605
|
1604
|
y = ((float)y_min) + iy*dy;
|
|
@@ -1665,7 +1664,7 @@
|
1665
|
1664
|
for (i = 0; i < GRID_MAX_POINTS_X; i++) {
|
1666
|
1665
|
for (j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
1667
|
1666
|
float x_tmp, y_tmp, z_tmp;
|
1668
|
|
- x_tmp = pgm_read_float(&(ubl.mesh_index_to_xpos[i]));
|
|
1667
|
+ x_tmp = pgm_read_float(&(ubl.mesh_index_to_xpos[i]));
|
1669
|
1668
|
y_tmp = pgm_read_float(&(ubl.mesh_index_to_ypos[j]));
|
1670
|
1669
|
z_tmp = ubl.z_values[i][j];
|
1671
|
1670
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|