|
@@ -1551,7 +1551,7 @@ inline void set_destination_to_current() { COPY(destination, current_position);
|
1551
|
1551
|
|
1552
|
1552
|
planner.buffer_line_kinematic(destination, MMS_SCALED(fr_mm_s ? fr_mm_s : feedrate_mm_s), active_extruder);
|
1553
|
1553
|
#endif
|
1554
|
|
-
|
|
1554
|
+
|
1555
|
1555
|
set_current_to_destination();
|
1556
|
1556
|
}
|
1557
|
1557
|
#endif // IS_KINEMATIC
|
|
@@ -2362,7 +2362,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2362
|
2362
|
else { // leveling from off to on
|
2363
|
2363
|
ubl.state.active = true; // enable BEFORE calling unapply_leveling, otherwise ignored
|
2364
|
2364
|
// change physical current_position to unleveled current_position without moving steppers.
|
2365
|
|
- planner.unapply_leveling(current_position);
|
|
2365
|
+ planner.unapply_leveling(current_position);
|
2366
|
2366
|
}
|
2367
|
2367
|
#else
|
2368
|
2368
|
ubl.state.active = enable; // just flip the bit, current_position will be wrong until next move.
|
|
@@ -2376,8 +2376,12 @@ static void clean_up_after_endstop_or_probe_move() {
|
2376
|
2376
|
(void)bilinear_z_offset(reset);
|
2377
|
2377
|
#endif
|
2378
|
2378
|
|
|
2379
|
+ // Enable or disable leveling compensation in the planner
|
2379
|
2380
|
planner.abl_enabled = enable;
|
|
2381
|
+
|
2380
|
2382
|
if (!enable)
|
|
2383
|
+ // When disabling just get the current position from the steppers.
|
|
2384
|
+ // This will yield the smallest error when first converted back to steps.
|
2381
|
2385
|
set_current_from_steppers_for_axis(
|
2382
|
2386
|
#if ABL_PLANAR
|
2383
|
2387
|
ALL_AXES
|
|
@@ -2386,9 +2390,11 @@ static void clean_up_after_endstop_or_probe_move() {
|
2386
|
2390
|
#endif
|
2387
|
2391
|
);
|
2388
|
2392
|
else
|
|
2393
|
+ // When enabling, remove compensation from the current position,
|
|
2394
|
+ // so compensation will give the right stepper counts.
|
2389
|
2395
|
planner.unapply_leveling(current_position);
|
2390
|
2396
|
|
2391
|
|
- #endif
|
|
2397
|
+ #endif // ABL
|
2392
|
2398
|
}
|
2393
|
2399
|
}
|
2394
|
2400
|
|
|
@@ -2396,24 +2402,23 @@ static void clean_up_after_endstop_or_probe_move() {
|
2396
|
2402
|
|
2397
|
2403
|
void set_z_fade_height(const float zfh) {
|
2398
|
2404
|
|
|
2405
|
+ const bool level_active = leveling_is_active();
|
|
2406
|
+
|
2399
|
2407
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
2400
|
2408
|
|
2401
|
|
- const bool level_active = leveling_is_active();
|
2402
|
|
- if (level_active) {
|
|
2409
|
+ if (level_active)
|
2403
|
2410
|
set_bed_leveling_enabled(false); // turn off before changing fade height for proper apply/unapply leveling to maintain current_position
|
2404
|
|
- }
|
2405
|
2411
|
planner.z_fade_height = zfh;
|
2406
|
2412
|
planner.inverse_z_fade_height = RECIPROCAL(zfh);
|
2407
|
|
- if (level_active) {
|
|
2413
|
+ if (level_active)
|
2408
|
2414
|
set_bed_leveling_enabled(true); // turn back on after changing fade height
|
2409
|
|
- }
|
2410
|
2415
|
|
2411
|
2416
|
#else
|
2412
|
2417
|
|
2413
|
2418
|
planner.z_fade_height = zfh;
|
2414
|
2419
|
planner.inverse_z_fade_height = RECIPROCAL(zfh);
|
2415
|
2420
|
|
2416
|
|
- if (leveling_is_active()) {
|
|
2421
|
+ if (level_active) {
|
2417
|
2422
|
set_current_from_steppers_for_axis(
|
2418
|
2423
|
#if ABL_PLANAR
|
2419
|
2424
|
ALL_AXES
|
|
@@ -9643,7 +9648,7 @@ inline void gcode_M355() {
|
9643
|
9648
|
#if HAS_CASE_LIGHT
|
9644
|
9649
|
uint8_t args = 0;
|
9645
|
9650
|
if (parser.seen('P')) ++args, case_light_brightness = parser.value_byte();
|
9646
|
|
- if (parser.seen('S')) ++args, case_light_on = parser.value_bool();
|
|
9651
|
+ if (parser.seen('S')) ++args, case_light_on = parser.value_bool();
|
9647
|
9652
|
if (args) update_case_light();
|
9648
|
9653
|
|
9649
|
9654
|
// always report case light status
|