|
@@ -490,8 +490,6 @@ static uint8_t target_extruder;
|
490
|
490
|
float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
491
|
491
|
#endif
|
492
|
492
|
|
493
|
|
-#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
|
494
|
|
-
|
495
|
493
|
#if HAS_ABL
|
496
|
494
|
float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
|
497
|
495
|
#define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
|
|
@@ -2405,7 +2403,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2405
|
2403
|
|
2406
|
2404
|
#endif // HAS_BED_PROBE
|
2407
|
2405
|
|
2408
|
|
-#if PLANNER_LEVELING
|
|
2406
|
+#if HAS_LEVELING
|
2409
|
2407
|
/**
|
2410
|
2408
|
* Turn bed leveling on or off, fixing the current
|
2411
|
2409
|
* position as-needed.
|
|
@@ -2426,7 +2424,12 @@ static void clean_up_after_endstop_or_probe_move() {
|
2426
|
2424
|
if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
|
2427
|
2425
|
}
|
2428
|
2426
|
|
2429
|
|
- #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
|
|
2427
|
+ #elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
2428
|
+
|
|
2429
|
+ ubl.state.active = enable;
|
|
2430
|
+ //set_current_from_steppers_for_axis(Z_AXIS);
|
|
2431
|
+
|
|
2432
|
+ #else
|
2430
|
2433
|
|
2431
|
2434
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
2432
|
2435
|
const bool can_change = (!enable || (bilinear_grid_spacing[0] && bilinear_grid_spacing[1]));
|
|
@@ -2454,9 +2457,6 @@ static void clean_up_after_endstop_or_probe_move() {
|
2454
|
2457
|
else
|
2455
|
2458
|
planner.unapply_leveling(current_position);
|
2456
|
2459
|
}
|
2457
|
|
- #elif ENABLED(AUTO_BED_LEVELING_UBL)
|
2458
|
|
- ubl.state.active = enable;
|
2459
|
|
- //set_current_from_steppers_for_axis(Z_AXIS);
|
2460
|
2460
|
#endif
|
2461
|
2461
|
}
|
2462
|
2462
|
|
|
@@ -2513,7 +2513,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2513
|
2513
|
#endif
|
2514
|
2514
|
}
|
2515
|
2515
|
|
2516
|
|
-#endif // PLANNER_LEVELING
|
|
2516
|
+#endif // HAS_LEVELING
|
2517
|
2517
|
|
2518
|
2518
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
|
2519
|
2519
|
|
|
@@ -3749,10 +3749,7 @@ inline void gcode_G28() {
|
3749
|
3749
|
#endif
|
3750
|
3750
|
|
3751
|
3751
|
// Disable the leveling matrix before homing
|
3752
|
|
- #if PLANNER_LEVELING
|
3753
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
3754
|
|
- const bool bed_leveling_state_at_entry = ubl.state.active;
|
3755
|
|
- #endif
|
|
3752
|
+ #if HAS_LEVELING
|
3756
|
3753
|
set_bed_leveling_enabled(false);
|
3757
|
3754
|
#endif
|
3758
|
3755
|
|
|
@@ -3895,25 +3892,6 @@ inline void gcode_G28() {
|
3895
|
3892
|
do_blocking_move_to_z(delta_clip_start_height);
|
3896
|
3893
|
#endif
|
3897
|
3894
|
|
3898
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
3899
|
|
- set_bed_leveling_enabled(bed_leveling_state_at_entry);
|
3900
|
|
- #endif
|
3901
|
|
-
|
3902
|
|
- // Enable mesh leveling again
|
3903
|
|
- #if ENABLED(MESH_BED_LEVELING)
|
3904
|
|
- if (mbl.reactivate()) {
|
3905
|
|
- set_bed_leveling_enabled(true);
|
3906
|
|
- if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
|
3907
|
|
- #if ENABLED(MESH_G28_REST_ORIGIN)
|
3908
|
|
- current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
3909
|
|
- set_destination_to_current();
|
3910
|
|
- line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
|
3911
|
|
- stepper.synchronize();
|
3912
|
|
- #endif
|
3913
|
|
- }
|
3914
|
|
- }
|
3915
|
|
- #endif
|
3916
|
|
-
|
3917
|
3895
|
clean_up_after_endstop_or_probe_move();
|
3918
|
3896
|
|
3919
|
3897
|
// Restore the active tool after homing
|
|
@@ -3928,6 +3906,8 @@ inline void gcode_G28() {
|
3928
|
3906
|
#endif
|
3929
|
3907
|
}
|
3930
|
3908
|
|
|
3909
|
+void home_all_axes() { gcode_G28(); }
|
|
3910
|
+
|
3931
|
3911
|
#if HAS_PROBING_PROCEDURE
|
3932
|
3912
|
|
3933
|
3913
|
void out_of_range_error(const char* p_edge) {
|
|
@@ -3980,6 +3960,18 @@ inline void gcode_G28() {
|
3980
|
3960
|
);
|
3981
|
3961
|
}
|
3982
|
3962
|
|
|
3963
|
+ void mesh_probing_done() {
|
|
3964
|
+ mbl.set_has_mesh(true);
|
|
3965
|
+ home_all_axes();
|
|
3966
|
+ set_bed_leveling_enabled(true);
|
|
3967
|
+ #if ENABLED(MESH_G28_REST_ORIGIN)
|
|
3968
|
+ current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
|
3969
|
+ set_destination_to_current();
|
|
3970
|
+ line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
|
|
3971
|
+ stepper.synchronize();
|
|
3972
|
+ #endif
|
|
3973
|
+ }
|
|
3974
|
+
|
3983
|
3975
|
/**
|
3984
|
3976
|
* G29: Mesh-based Z probe, probes a grid and produces a
|
3985
|
3977
|
* mesh to compensate for variable bed height
|
|
@@ -4070,14 +4062,12 @@ inline void gcode_G28() {
|
4070
|
4062
|
line_to_current_position();
|
4071
|
4063
|
stepper.synchronize();
|
4072
|
4064
|
|
4073
|
|
- // After recording the last point, activate the mbl and home
|
4074
|
|
- SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
|
4065
|
+ // After recording the last point, activate home and activate
|
4075
|
4066
|
mbl_probe_index = -1;
|
4076
|
|
- mbl.set_has_mesh(true);
|
4077
|
|
- mbl.set_reactivate(true);
|
4078
|
|
- enqueue_and_echo_commands_P(PSTR("G28"));
|
|
4067
|
+ SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
4079
|
4068
|
BUZZ(100, 659);
|
4080
|
4069
|
BUZZ(100, 698);
|
|
4070
|
+ mesh_probing_done();
|
4081
|
4071
|
}
|
4082
|
4072
|
break;
|
4083
|
4073
|
|
|
@@ -4368,7 +4358,7 @@ inline void gcode_G28() {
|
4368
|
4358
|
|
4369
|
4359
|
#endif
|
4370
|
4360
|
|
4371
|
|
- #if PLANNER_LEVELING
|
|
4361
|
+ #if HAS_LEVELING
|
4372
|
4362
|
|
4373
|
4363
|
// Jettison bed leveling data
|
4374
|
4364
|
if (code_seen('J')) {
|
|
@@ -5013,7 +5003,7 @@ inline void gcode_G28() {
|
5013
|
5003
|
SYNC_PLAN_POSITION_KINEMATIC();
|
5014
|
5004
|
}
|
5015
|
5005
|
|
5016
|
|
-#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
|
|
5006
|
+#endif // HAS_ABL && !AUTO_BED_LEVELING_UBL
|
5017
|
5007
|
|
5018
|
5008
|
#if HAS_BED_PROBE
|
5019
|
5009
|
|
|
@@ -5034,7 +5024,7 @@ inline void gcode_G28() {
|
5034
|
5024
|
if (!position_is_reachable(pos, true)) return;
|
5035
|
5025
|
|
5036
|
5026
|
// Disable leveling so the planner won't mess with us
|
5037
|
|
- #if PLANNER_LEVELING
|
|
5027
|
+ #if HAS_LEVELING
|
5038
|
5028
|
set_bed_leveling_enabled(false);
|
5039
|
5029
|
#endif
|
5040
|
5030
|
|
|
@@ -5091,7 +5081,7 @@ inline void gcode_G28() {
|
5091
|
5081
|
|
5092
|
5082
|
stepper.synchronize();
|
5093
|
5083
|
|
5094
|
|
- #if PLANNER_LEVELING
|
|
5084
|
+ #if HAS_LEVELING
|
5095
|
5085
|
set_bed_leveling_enabled(false);
|
5096
|
5086
|
#endif
|
5097
|
5087
|
|
|
@@ -6198,10 +6188,6 @@ inline void gcode_M42() {
|
6198
|
6188
|
* regenerated.
|
6199
|
6189
|
*/
|
6200
|
6190
|
inline void gcode_M48() {
|
6201
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
6202
|
|
- bool bed_leveling_state_at_entry=0;
|
6203
|
|
- bed_leveling_state_at_entry = ubl.state.active;
|
6204
|
|
- #endif
|
6205
|
6191
|
|
6206
|
6192
|
if (axis_unhomed_error(true, true, true)) return;
|
6207
|
6193
|
|
|
@@ -6220,8 +6206,8 @@ inline void gcode_M42() {
|
6220
|
6206
|
return;
|
6221
|
6207
|
}
|
6222
|
6208
|
|
6223
|
|
- float X_current = current_position[X_AXIS],
|
6224
|
|
- Y_current = current_position[Y_AXIS];
|
|
6209
|
+ float X_current = current_position[X_AXIS],
|
|
6210
|
+ Y_current = current_position[Y_AXIS];
|
6225
|
6211
|
|
6226
|
6212
|
bool stow_probe_after_each = code_seen('E');
|
6227
|
6213
|
|
|
@@ -6267,8 +6253,17 @@ inline void gcode_M42() {
|
6267
|
6253
|
SERIAL_PROTOCOLLNPGM("Positioning the probe...");
|
6268
|
6254
|
|
6269
|
6255
|
// Disable bed level correction in M48 because we want the raw data when we probe
|
6270
|
|
- #if HAS_ABL
|
6271
|
|
- const bool abl_was_enabled = planner.abl_enabled;
|
|
6256
|
+
|
|
6257
|
+ #if HAS_LEVELING
|
|
6258
|
+ const bool was_enabled =
|
|
6259
|
+ #if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
6260
|
+ ubl.state.active
|
|
6261
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
6262
|
+ mbl.active()
|
|
6263
|
+ #else
|
|
6264
|
+ planner.abl_enabled
|
|
6265
|
+ #endif
|
|
6266
|
+ ;
|
6272
|
6267
|
set_bed_leveling_enabled(false);
|
6273
|
6268
|
#endif
|
6274
|
6269
|
|
|
@@ -6420,14 +6415,9 @@ inline void gcode_M42() {
|
6420
|
6415
|
|
6421
|
6416
|
clean_up_after_endstop_or_probe_move();
|
6422
|
6417
|
|
6423
|
|
- // Re-enable bed level correction if it has been on
|
|
6418
|
+ // Re-enable bed level correction if it had been on
|
6424
|
6419
|
#if HAS_ABL
|
6425
|
|
- set_bed_leveling_enabled(abl_was_enabled);
|
6426
|
|
- #endif
|
6427
|
|
-
|
6428
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
6429
|
|
- set_bed_leveling_enabled(bed_leveling_state_at_entry);
|
6430
|
|
- ubl.state.active = bed_leveling_state_at_entry;
|
|
6420
|
+ set_bed_leveling_enabled(was_enabled);
|
6431
|
6421
|
#endif
|
6432
|
6422
|
|
6433
|
6423
|
report_current_position();
|
|
@@ -7294,7 +7284,7 @@ inline void gcode_M115() {
|
7294
|
7284
|
#endif
|
7295
|
7285
|
|
7296
|
7286
|
// MESH_REPORT (M420 V)
|
7297
|
|
- #if PLANNER_LEVELING
|
|
7287
|
+ #if HAS_LEVELING
|
7298
|
7288
|
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
|
7299
|
7289
|
#else
|
7300
|
7290
|
SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
|
|
@@ -8336,7 +8326,7 @@ void quickstop_stepper() {
|
8336
|
8326
|
SYNC_PLAN_POSITION_KINEMATIC();
|
8337
|
8327
|
}
|
8338
|
8328
|
|
8339
|
|
-#if PLANNER_LEVELING
|
|
8329
|
+#if HAS_LEVELING
|
8340
|
8330
|
/**
|
8341
|
8331
|
* M420: Enable/Disable Bed Leveling and/or set the Z fade height.
|
8342
|
8332
|
*
|
|
@@ -9857,12 +9847,12 @@ void process_next_command() {
|
9857
|
9847
|
gcode_G28();
|
9858
|
9848
|
break;
|
9859
|
9849
|
|
9860
|
|
- #if PLANNER_LEVELING || ENABLED(AUTO_BED_LEVELING_UBL)
|
|
9850
|
+ #if HAS_LEVELING
|
9861
|
9851
|
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
|
9862
|
9852
|
// or provides access to the UBL System if enabled.
|
9863
|
9853
|
gcode_G29();
|
9864
|
9854
|
break;
|
9865
|
|
- #endif // PLANNER_LEVELING
|
|
9855
|
+ #endif // HAS_LEVELING
|
9866
|
9856
|
|
9867
|
9857
|
#if HAS_BED_PROBE
|
9868
|
9858
|
|
|
@@ -10363,7 +10353,7 @@ void process_next_command() {
|
10363
|
10353
|
break;
|
10364
|
10354
|
#endif // FILAMENT_WIDTH_SENSOR
|
10365
|
10355
|
|
10366
|
|
- #if PLANNER_LEVELING
|
|
10356
|
+ #if HAS_LEVELING
|
10367
|
10357
|
case 420: // M420: Enable/Disable Bed Leveling
|
10368
|
10358
|
gcode_M420();
|
10369
|
10359
|
break;
|
|
@@ -10917,7 +10907,7 @@ void get_cartesian_from_steppers() {
|
10917
|
10907
|
*/
|
10918
|
10908
|
void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
10919
|
10909
|
get_cartesian_from_steppers();
|
10920
|
|
- #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
|
|
10910
|
+ #if PLANNER_LEVELING
|
10921
|
10911
|
planner.unapply_leveling(cartes);
|
10922
|
10912
|
#endif
|
10923
|
10913
|
if (axis == ALL_AXES)
|