|
@@ -135,9 +135,9 @@
|
135
|
135
|
* a subsequent G or T leveling operation for backward compatibility.
|
136
|
136
|
*
|
137
|
137
|
* P1 Phase 1 Invalidate entire Mesh and continue with automatic generation of the Mesh data using
|
138
|
|
- * the Z-Probe. Usually the probe can not reach all areas that the nozzle can reach.
|
139
|
|
- * In Cartesian printers, mesh points within the X_OFFSET_FROM_EXTRUDER and Y_OFFSET_FROM_EXTRUDER
|
140
|
|
- * area can not be automatically probed. For Delta printers the area in which DELTA_PROBEABLE_RADIUS
|
|
138
|
+ * the Z-Probe. Usually the probe can't reach all areas that the nozzle can reach. On
|
|
139
|
+ * Cartesian printers, points within the X_PROBE_OFFSET_FROM_EXTRUDER and Y_PROBE_OFFSET_FROM_EXTRUDER
|
|
140
|
+ * area cannot be automatically probed. For Delta printers the area in which DELTA_PROBEABLE_RADIUS
|
141
|
141
|
* and DELTA_PRINTABLE_RADIUS do not overlap will not be automatically probed.
|
142
|
142
|
*
|
143
|
143
|
* These points will be handled in Phase 2 and Phase 3. If the Phase 1 command is given the
|
|
@@ -186,20 +186,20 @@
|
186
|
186
|
* of the Mesh being built.
|
187
|
187
|
*
|
188
|
188
|
* P3 Phase 3 Fill the unpopulated regions of the Mesh with a fixed value. There are two different paths the
|
189
|
|
- * user can go down. If the user specifies the value using the C parameter, the closest invalid
|
190
|
|
- * mesh points to the nozzle will be filled. The user can specify a repeat count using the R
|
|
189
|
+ * user can go down. If the user specifies the value using the C parameter, the closest invalid
|
|
190
|
+ * mesh points to the nozzle will be filled. The user can specify a repeat count using the R
|
191
|
191
|
* parameter with the C version of the command.
|
192
|
192
|
*
|
193
|
|
- * A second version of the fill command is available if no C constant is specified. Not
|
194
|
|
- * specifying a C constant will invoke the 'Smart Fill' algorithm. The G29 P3 command will search
|
195
|
|
- * from the edges of the mesh inward looking for invalid mesh points. It will look at the next
|
196
|
|
- * several mesh points to determine if the print bed is sloped up or down. If the bed is sloped
|
|
193
|
+ * A second version of the fill command is available if no C constant is specified. Not
|
|
194
|
+ * specifying a C constant will invoke the 'Smart Fill' algorithm. The G29 P3 command will search
|
|
195
|
+ * from the edges of the mesh inward looking for invalid mesh points. It will look at the next
|
|
196
|
+ * several mesh points to determine if the print bed is sloped up or down. If the bed is sloped
|
197
|
197
|
* upward from the invalid mesh point, it will be replaced with the value of the nearest mesh point.
|
198
|
198
|
* If the bed is sloped downward from the invalid mesh point, it will be replaced with a value that
|
199
|
|
- * puts all three points in a line. The second version of the G29 P3 command is a quick, easy and
|
|
199
|
+ * puts all three points in a line. The second version of the G29 P3 command is a quick, easy and
|
200
|
200
|
* usually safe way to populate the unprobed regions of your mesh so you can continue to the G26
|
201
|
|
- * Mesh Validation Pattern phase. Please note that you are populating your mesh with unverified
|
202
|
|
- * numbers. You should use some scrutiny and caution.
|
|
201
|
+ * Mesh Validation Pattern phase. Please note that you are populating your mesh with unverified
|
|
202
|
+ * numbers. You should use some scrutiny and caution.
|
203
|
203
|
*
|
204
|
204
|
* P4 Phase 4 Fine tune the Mesh. The Delta Mesh Compensation System assume the existence of
|
205
|
205
|
* an LCD Panel. It is possible to fine tune the mesh without the use of an LCD Panel.
|
|
@@ -242,7 +242,7 @@
|
242
|
242
|
* command is not anticipated to be of much value to the typical user. It is intended
|
243
|
243
|
* for developers to help them verify correct operation of the Unified Bed Leveling System.
|
244
|
244
|
*
|
245
|
|
- * R # Repeat Repeat this command the specified number of times. If no number is specified the
|
|
245
|
+ * R # Repeat Repeat this command the specified number of times. If no number is specified the
|
246
|
246
|
* command will be repeated GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y times.
|
247
|
247
|
*
|
248
|
248
|
* S Store Store the current Mesh in the Activated area of the EEPROM. It will also store the
|
|
@@ -497,7 +497,7 @@
|
497
|
497
|
|
498
|
498
|
if (code_seen('H') && code_has_value()) height = code_value_float();
|
499
|
499
|
|
500
|
|
- if ( !position_is_reachable_xy( x_pos, y_pos )) {
|
|
500
|
+ if (!position_is_reachable_xy(x_pos, y_pos)) {
|
501
|
501
|
SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
|
502
|
502
|
return;
|
503
|
503
|
}
|
|
@@ -635,7 +635,7 @@
|
635
|
635
|
ubl.display_map(code_has_value() ? code_value_int() : 0);
|
636
|
636
|
|
637
|
637
|
/*
|
638
|
|
- * This code may not be needed... Prepare for its removal...
|
|
638
|
+ * This code may not be needed... Prepare for its removal...
|
639
|
639
|
*
|
640
|
640
|
if (code_seen('Z')) {
|
641
|
641
|
if (code_has_value())
|
|
@@ -660,9 +660,9 @@
|
660
|
660
|
do_blocking_move_to_z(measured_z);
|
661
|
661
|
} while (!ubl_lcd_clicked());
|
662
|
662
|
|
663
|
|
- ubl.has_control_of_lcd_panel = true; // There is a race condition for the Encoder Wheel getting clicked.
|
|
663
|
+ ubl.has_control_of_lcd_panel = true; // There is a race condition for the encoder click.
|
664
|
664
|
// It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune)
|
665
|
|
- // or here. So, until we are done looking for a long Encoder Wheel Press,
|
|
665
|
+ // or here. So, until we are done looking for a long encoder press,
|
666
|
666
|
// we need to take control of the panel
|
667
|
667
|
|
668
|
668
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
@@ -1346,10 +1346,10 @@
|
1346
|
1346
|
my = pgm_read_float(&ubl.mesh_index_to_ypos[j]);
|
1347
|
1347
|
|
1348
|
1348
|
// If using the probe as the reference there are some unreachable locations.
|
1349
|
|
- // Also for round beds, there are grid points outside the bed that nozzle can't reach.
|
|
1349
|
+ // Also for round beds, there are grid points outside the bed the nozzle can't reach.
|
1350
|
1350
|
// Prune them from the list and ignore them till the next Phase (manual nozzle probing).
|
1351
|
1351
|
|
1352
|
|
- if ( ! (probe_as_reference ? position_is_reachable_by_probe_raw_xy(mx, my) : position_is_reachable_raw_xy(mx, my)) )
|
|
1352
|
+ if (probe_as_reference ? !position_is_reachable_by_probe_raw_xy(mx, my) : !position_is_reachable_raw_xy(mx, my))
|
1353
|
1353
|
continue;
|
1354
|
1354
|
|
1355
|
1355
|
// Reachable. Check if it's the closest location to the nozzle.
|
|
@@ -1390,14 +1390,14 @@
|
1390
|
1390
|
}
|
1391
|
1391
|
|
1392
|
1392
|
void fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map) {
|
1393
|
|
- if (!code_seen('R')) // fine_tune_mesh() is special. If no repetion count flag is specified
|
1394
|
|
- repetition_cnt = 1; // we know to do exactly one mesh location. Otherwise we use what the parser decided.
|
|
1393
|
+ if (!code_seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified
|
|
1394
|
+ repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided.
|
1395
|
1395
|
|
1396
|
1396
|
mesh_index_pair location;
|
1397
|
1397
|
uint16_t not_done[16];
|
1398
|
1398
|
int32_t round_off;
|
1399
|
1399
|
|
1400
|
|
- if ( ! position_is_reachable_xy( lx, ly )) {
|
|
1400
|
+ if (!position_is_reachable_xy(lx, ly)) {
|
1401
|
1401
|
SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
|
1402
|
1402
|
return;
|
1403
|
1403
|
}
|
|
@@ -1413,7 +1413,7 @@
|
1413
|
1413
|
do {
|
1414
|
1414
|
location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false);
|
1415
|
1415
|
|
1416
|
|
- if (location.x_index < 0 ) break; // stop when we can't find any more reachable points.
|
|
1416
|
+ if (location.x_index < 0) break; // stop when we can't find any more reachable points.
|
1417
|
1417
|
|
1418
|
1418
|
bit_clear(not_done, location.x_index, location.y_index); // Mark this location as 'adjusted' so we will find a
|
1419
|
1419
|
// different location the next time through the loop
|
|
@@ -1421,9 +1421,8 @@
|
1421
|
1421
|
const float rawx = pgm_read_float(&ubl.mesh_index_to_xpos[location.x_index]),
|
1422
|
1422
|
rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]);
|
1423
|
1423
|
|
1424
|
|
- if ( ! position_is_reachable_raw_xy( rawx, rawy )) { // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
|
|
1424
|
+ if (!position_is_reachable_raw_xy(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
|
1425
|
1425
|
break;
|
1426
|
|
- }
|
1427
|
1426
|
|
1428
|
1427
|
float new_z = ubl.z_values[location.x_index][location.y_index];
|
1429
|
1428
|
|
|
@@ -1432,8 +1431,7 @@
|
1432
|
1431
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); // Move the nozzle to where we are going to edit
|
1433
|
1432
|
do_blocking_move_to_xy(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy));
|
1434
|
1433
|
|
1435
|
|
- round_off = (int32_t)(new_z * 1000.0); // we chop off the last digits just to be clean. We are rounding to the
|
1436
|
|
- new_z = float(round_off) / 1000.0;
|
|
1434
|
+ new_z = floor(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
|
1437
|
1435
|
|
1438
|
1436
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
1439
|
1437
|
ubl.has_control_of_lcd_panel = true;
|
|
@@ -1451,9 +1449,9 @@
|
1451
|
1449
|
|
1452
|
1450
|
lcd_return_to_status();
|
1453
|
1451
|
|
1454
|
|
- // There is a race condition for the Encoder Wheel getting clicked.
|
1455
|
|
- // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune)
|
1456
|
|
- // or here.
|
|
1452
|
+ // The technique used here generates a race condition for the encoder click.
|
|
1453
|
+ // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here.
|
|
1454
|
+ // Let's work on specifying a proper API for the LCD ASAP, OK?
|
1457
|
1455
|
ubl.has_control_of_lcd_panel = true;
|
1458
|
1456
|
}
|
1459
|
1457
|
|
|
@@ -1478,7 +1476,7 @@
|
1478
|
1476
|
|
1479
|
1477
|
lcd_implementation_clear();
|
1480
|
1478
|
|
1481
|
|
- } while (( location.x_index >= 0 ) && (--repetition_cnt>0));
|
|
1479
|
+ } while (location.x_index >= 0 && --repetition_cnt > 0);
|
1482
|
1480
|
|
1483
|
1481
|
FINE_TUNE_EXIT:
|
1484
|
1482
|
|