Преглед на файлове

For set_z_fade_height use set_bed_leveling_enabled

Scott Lahteine преди 7 години
родител
ревизия
1a75165f35
променени са 2 файла, в които са добавени 7 реда и са изтрити 21 реда
  1. 5
    19
      Marlin/src/feature/bedlevel/bedlevel.cpp
  2. 2
    2
      Marlin/src/gcode/calibrate/G28.cpp

+ 5
- 19
Marlin/src/feature/bedlevel/bedlevel.cpp Целия файл

@@ -138,30 +138,16 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
138 138
 
139 139
   void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
140 140
 
141
-    if (planner.z_fade_height == zfh) return; // do nothing if no change
141
+    if (planner.z_fade_height == zfh) return;
142 142
 
143
-    const bool level_active = planner.leveling_active;
144
-
145
-    #if ENABLED(AUTO_BED_LEVELING_UBL)
146
-      if (level_active) set_bed_leveling_enabled(false);  // turn off before changing fade height for proper apply/unapply leveling to maintain current_position
147
-    #endif
143
+    const bool leveling_was_active = planner.leveling_active;
144
+    set_bed_leveling_enabled(false);
148 145
 
149 146
     planner.set_z_fade_height(zfh);
150 147
 
151
-    if (level_active) {
148
+    if (leveling_was_active) {
152 149
       const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
153
-      #if ENABLED(AUTO_BED_LEVELING_UBL)
154
-        set_bed_leveling_enabled(true);  // turn back on after changing fade height
155
-      #else
156
-        set_current_from_steppers_for_axis(
157
-          #if ABL_PLANAR
158
-            ALL_AXES
159
-          #else
160
-            Z_AXIS
161
-          #endif
162
-        );
163
-        SYNC_PLAN_POSITION_KINEMATIC();
164
-      #endif
150
+      set_bed_leveling_enabled(true);
165 151
       if (do_report && memcmp(oldpos, current_position, sizeof(oldpos)))
166 152
         report_current_position();
167 153
     }

+ 2
- 2
Marlin/src/gcode/calibrate/G28.cpp Целия файл

@@ -179,7 +179,7 @@ void GcodeSuite::G28(const bool always_home_all) {
179 179
   // Disable the leveling matrix before homing
180 180
   #if HAS_LEVELING
181 181
     #if ENABLED(RESTORE_LEVELING_AFTER_G28)
182
-      const bool leveling_state_at_entry = planner.leveling_active;
182
+      const bool leveling_was_active = planner.leveling_active;
183 183
     #endif
184 184
     set_bed_leveling_enabled(false);
185 185
   #endif
@@ -326,7 +326,7 @@ void GcodeSuite::G28(const bool always_home_all) {
326 326
   #endif
327 327
 
328 328
   #if ENABLED(RESTORE_LEVELING_AFTER_G28)
329
-    set_bed_leveling_enabled(leveling_state_at_entry);
329
+    set_bed_leveling_enabled(leveling_was_active);
330 330
   #endif
331 331
 
332 332
   clean_up_after_endstop_or_probe_move();

Loading…
Отказ
Запис