|
@@ -9320,22 +9320,17 @@ inline void gcode_M226() {
|
9320
|
9320
|
for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
|
9321
|
9321
|
if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
|
9322
|
9322
|
const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
|
|
9323
|
+ thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]);
|
9323
|
9324
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
9324
|
|
- if (a == Z_AXIS) {
|
9325
|
|
- zprobe_zoffset += offs;
|
9326
|
|
- refresh_zprobe_zoffset(true); // 'true' to not babystep
|
9327
|
|
- }
|
|
9325
|
+ zprobe_zoffset += offs;
|
9328
|
9326
|
#endif
|
9329
|
|
- thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]);
|
9330
|
9327
|
}
|
9331
|
9328
|
#else
|
9332
|
9329
|
if (parser.seenval('Z') || parser.seenval('S')) {
|
9333
|
9330
|
const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
|
|
9331
|
+ thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]);
|
9334
|
9332
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
9335
|
9333
|
zprobe_zoffset += offs;
|
9336
|
|
- refresh_zprobe_zoffset(); // This will babystep the axis
|
9337
|
|
- #else
|
9338
|
|
- thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]);
|
9339
|
9334
|
#endif
|
9340
|
9335
|
}
|
9341
|
9336
|
#endif
|
|
@@ -10039,42 +10034,6 @@ inline void gcode_M502() {
|
10039
|
10034
|
|
10040
|
10035
|
#if HAS_BED_PROBE
|
10041
|
10036
|
|
10042
|
|
- void refresh_zprobe_zoffset(const bool no_babystep/*=false*/) {
|
10043
|
|
- static float last_zoffset = NAN;
|
10044
|
|
-
|
10045
|
|
- if (!isnan(last_zoffset)) {
|
10046
|
|
-
|
10047
|
|
- #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(BABYSTEP_ZPROBE_OFFSET) || ENABLED(DELTA)
|
10048
|
|
- const float diff = zprobe_zoffset - last_zoffset;
|
10049
|
|
- #endif
|
10050
|
|
-
|
10051
|
|
- #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
10052
|
|
- // Correct bilinear grid for new probe offset
|
10053
|
|
- if (diff) {
|
10054
|
|
- for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
|
10055
|
|
- for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
|
10056
|
|
- z_values[x][y] -= diff;
|
10057
|
|
- }
|
10058
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
10059
|
|
- bed_level_virt_interpolate();
|
10060
|
|
- #endif
|
10061
|
|
- #endif
|
10062
|
|
-
|
10063
|
|
- #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
10064
|
|
- if (!no_babystep && planner.leveling_active)
|
10065
|
|
- thermalManager.babystep_axis(Z_AXIS, -LROUND(diff * planner.axis_steps_per_mm[Z_AXIS]));
|
10066
|
|
- #else
|
10067
|
|
- UNUSED(no_babystep);
|
10068
|
|
- #endif
|
10069
|
|
-
|
10070
|
|
- #if ENABLED(DELTA) // correct the delta_height
|
10071
|
|
- delta_height -= diff;
|
10072
|
|
- #endif
|
10073
|
|
- }
|
10074
|
|
-
|
10075
|
|
- last_zoffset = zprobe_zoffset;
|
10076
|
|
- }
|
10077
|
|
-
|
10078
|
10037
|
inline void gcode_M851() {
|
10079
|
10038
|
SERIAL_ECHO_START();
|
10080
|
10039
|
SERIAL_ECHOPGM(MSG_ZPROBE_ZOFFSET " ");
|
|
@@ -10082,7 +10041,6 @@ inline void gcode_M502() {
|
10082
|
10041
|
const float value = parser.value_linear_units();
|
10083
|
10042
|
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
10084
|
10043
|
zprobe_zoffset = value;
|
10085
|
|
- refresh_zprobe_zoffset();
|
10086
|
10044
|
SERIAL_ECHO(zprobe_zoffset);
|
10087
|
10045
|
}
|
10088
|
10046
|
else
|