|
@@ -8477,7 +8477,7 @@ void quickstop_stepper() {
|
8477
|
8477
|
}
|
8478
|
8478
|
}
|
8479
|
8479
|
|
8480
|
|
-#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
|
|
8480
|
+#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
8481
|
8481
|
|
8482
|
8482
|
/**
|
8483
|
8483
|
* M421: Set a single Mesh Bed Leveling Z coordinate
|
|
@@ -8490,8 +8490,8 @@ void quickstop_stepper() {
|
8490
|
8490
|
int8_t px = 0, py = 0;
|
8491
|
8491
|
float z = 0;
|
8492
|
8492
|
bool hasI, hasJ, hasZ, hasQ;
|
8493
|
|
- if ((hasI = code_seen('I'))) px = code_value_linear_units();
|
8494
|
|
- if ((hasJ = code_seen('J'))) py = code_value_linear_units();
|
|
8493
|
+ if ((hasI = code_seen('I'))) px = code_value_int();
|
|
8494
|
+ if ((hasJ = code_seen('J'))) py = code_value_int();
|
8495
|
8495
|
if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
|
8496
|
8496
|
if ((hasQ = code_seen('Q'))) z = code_value_linear_units();
|
8497
|
8497
|
|
|
@@ -8503,23 +8503,15 @@ void quickstop_stepper() {
|
8503
|
8503
|
|
8504
|
8504
|
if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
|
8505
|
8505
|
if (hasZ) { // doing an absolute mesh value
|
8506
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
8507
|
|
- ubl.z_values[px][py] = z;
|
8508
|
|
- #else
|
8509
|
|
- z_values[px][py] = z;
|
8510
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
8511
|
|
- bed_level_virt_interpolate();
|
8512
|
|
- #endif
|
|
8506
|
+ z_values[px][py] = z;
|
|
8507
|
+ #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
|
8508
|
+ bed_level_virt_interpolate();
|
8513
|
8509
|
#endif
|
8514
|
8510
|
}
|
8515
|
8511
|
else { // doing an offset of a mesh value
|
8516
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
8517
|
|
- ubl.z_values[px][py] += z;
|
8518
|
|
- #else
|
8519
|
|
- z_values[px][py] += z;
|
8520
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
8521
|
|
- bed_level_virt_interpolate();
|
8522
|
|
- #endif
|
|
8512
|
+ z_values[px][py] += z;
|
|
8513
|
+ #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
|
8514
|
+ bed_level_virt_interpolate();
|
8523
|
8515
|
#endif
|
8524
|
8516
|
}
|
8525
|
8517
|
}
|
|
@@ -8528,6 +8520,52 @@ void quickstop_stepper() {
|
8528
|
8520
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
8529
|
8521
|
}
|
8530
|
8522
|
}
|
|
8523
|
+
|
|
8524
|
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
8525
|
+
|
|
8526
|
+ /**
|
|
8527
|
+ * M421: Set a single Mesh Bed Leveling Z coordinate
|
|
8528
|
+ *
|
|
8529
|
+ * M421 I<xindex> J<yindex> Z<linear>
|
|
8530
|
+ * or
|
|
8531
|
+ * M421 I<xindex> J<yindex> Q<offset>
|
|
8532
|
+ */
|
|
8533
|
+
|
|
8534
|
+ //todo: change multiple points simultaneously?
|
|
8535
|
+
|
|
8536
|
+ inline void gcode_M421() {
|
|
8537
|
+ int8_t px = 0, py = 0;
|
|
8538
|
+ float z = 0;
|
|
8539
|
+ bool hasI, hasJ, hasZ, hasQ, hasC;
|
|
8540
|
+ if ((hasI = code_seen('I'))) px = code_value_int();
|
|
8541
|
+ if ((hasJ = code_seen('J'))) py = code_value_int();
|
|
8542
|
+ if ((hasZ = code_seen('Z'))) z = code_value_linear_units();
|
|
8543
|
+ if ((hasQ = code_seen('Q'))) z = code_value_linear_units();
|
|
8544
|
+ hasC = code_seen('C');
|
|
8545
|
+
|
|
8546
|
+ if ( (!(hasI && hasJ) && !hasC) || (hasQ && hasZ) || (!hasQ && !hasZ)) {
|
|
8547
|
+ SERIAL_ERROR_START;
|
|
8548
|
+ SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
|
|
8549
|
+ return;
|
|
8550
|
+ }
|
|
8551
|
+
|
|
8552
|
+ if (hasC) { // get closest position
|
|
8553
|
+ const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL, false);
|
|
8554
|
+ px = location.x_index;
|
|
8555
|
+ py = location.y_index;
|
|
8556
|
+ }
|
|
8557
|
+
|
|
8558
|
+ if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
|
|
8559
|
+ if (hasZ) // doing an absolute mesh value
|
|
8560
|
+ ubl.z_values[px][py] = z;
|
|
8561
|
+ else // doing an offset of a mesh value
|
|
8562
|
+ ubl.z_values[px][py] += z;
|
|
8563
|
+ }
|
|
8564
|
+ else { // bad indexes were specified for the mesh point
|
|
8565
|
+ SERIAL_ERROR_START;
|
|
8566
|
+ SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
|
8567
|
+ }
|
|
8568
|
+ }
|
8531
|
8569
|
#endif
|
8532
|
8570
|
|
8533
|
8571
|
#if HAS_M206_COMMAND
|