Browse Source

Add RESTORE_LEVELING_AFTER_G28 option

Scott Lahteine 7 years ago
parent
commit
b2cf253a13

+ 2
- 2
.travis.yml View File

@@ -83,7 +83,7 @@ script:
83 83
   - opt_set TEMP_SENSOR_3 20
84 84
   - opt_set TEMP_SENSOR_4 999
85 85
   - opt_set TEMP_SENSOR_BED 1
86
-  - opt_enable AUTO_BED_LEVELING_UBL DEBUG_LEVELING_FEATURE G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS EEPROM_CHITCHAT G3D_PANEL SKEW_CORRECTION
86
+  - opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS EEPROM_CHITCHAT G3D_PANEL SKEW_CORRECTION
87 87
   - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING BABYSTEP_XY LIN_ADVANCE NANODLP_Z_SYNC QUICK_HOME
88 88
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
89 89
   #
@@ -299,7 +299,7 @@ script:
299 299
   #
300 300
   - use_example_configs delta/generic
301 301
   - opt_disable DISABLE_MIN_ENDSTOPS
302
-  - opt_enable AUTO_BED_LEVELING_UBL Z_PROBE_ALLEN_KEY EEPROM_SETTINGS EEPROM_CHITCHAT OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY
302
+  - opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 Z_PROBE_ALLEN_KEY EEPROM_SETTINGS EEPROM_CHITCHAT OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY
303 303
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
304 304
   #
305 305
   # Delta Config (FLSUN AC because it's complex)

+ 6
- 0
Marlin/Configuration.h View File

@@ -913,6 +913,12 @@
913 913
 //#define MESH_BED_LEVELING
914 914
 
915 915
 /**
916
+ * Normally G28 leaves leveling disabled on completion. Enable
917
+ * this option to have G28 restore the prior leveling state.
918
+ */
919
+//#define RESTORE_LEVELING_AFTER_G28
920
+
921
+/**
916 922
  * Enable detailed logging of G28, G29, M48, etc.
917 923
  * Turn on with the command 'M111 S32'.
918 924
  * NOTE: Requires a lot of PROGMEM!

+ 6
- 0
Marlin/src/config/default/Configuration.h View File

@@ -913,6 +913,12 @@
913 913
 //#define MESH_BED_LEVELING
914 914
 
915 915
 /**
916
+ * Normally G28 leaves leveling disabled on completion. Enable
917
+ * this option to have G28 restore the prior leveling state.
918
+ */
919
+//#define RESTORE_LEVELING_AFTER_G28
920
+
921
+/**
916 922
  * Enable detailed logging of G28, G29, M48, etc.
917 923
  * Turn on with the command 'M111 S32'.
918 924
  * NOTE: Requires a lot of PROGMEM!

+ 4
- 4
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -183,8 +183,8 @@ void GcodeSuite::G28(const bool always_home_all) {
183 183
 
184 184
   // Disable the leveling matrix before homing
185 185
   #if HAS_LEVELING
186
-    #if ENABLED(AUTO_BED_LEVELING_UBL)
187
-      const bool ubl_state_at_entry = planner.leveling_active;
186
+    #if ENABLED(RESTORE_LEVELING_AFTER_G28)
187
+      const bool leveling_state_at_entry = planner.leveling_active;
188 188
     #endif
189 189
     set_bed_leveling_enabled(false);
190 190
   #endif
@@ -319,8 +319,8 @@ void GcodeSuite::G28(const bool always_home_all) {
319 319
     do_blocking_move_to_z(delta_clip_start_height);
320 320
   #endif
321 321
 
322
-  #if ENABLED(AUTO_BED_LEVELING_UBL)
323
-    set_bed_leveling_enabled(ubl_state_at_entry);
322
+  #if ENABLED(RESTORE_LEVELING_AFTER_G28)
323
+    set_bed_leveling_enabled(leveling_state_at_entry);
324 324
   #endif
325 325
 
326 326
   clean_up_after_endstop_or_probe_move();

+ 2
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -834,6 +834,8 @@ static_assert(1 >= 0
834 834
     #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS. Please update your configuration."
835 835
   #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15)
836 836
     #error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15."
837
+  #elif DISABLED(RESTORE_LEVELING_AFTER_G28)
838
+    #error "AUTO_BED_LEVELING_UBL (<=1.1.8) always has RESTORE_LEVELING_AFTER_G28 enabled. To keep this behavior, #define RESTORE_LEVELING_AFTER_G28. To keep it disabled comment out this line in SanityCheck.h."
837 839
   #else
838 840
     static_assert(WITHIN(UBL_PROBE_PT_1_X, MIN_PROBE_X, MAX_PROBE_X), "UBL_PROBE_PT_1_X can't be reached by the Z probe.");
839 841
     static_assert(WITHIN(UBL_PROBE_PT_2_X, MIN_PROBE_X, MAX_PROBE_X), "UBL_PROBE_PT_2_X can't be reached by the Z probe.");

Loading…
Cancel
Save