Browse Source

Add a mesh edit menu for MBL / ABL-Bilinear

KangDroid 7 years ago
parent
commit
82ff7c6542

+ 3
- 2
Marlin/Configuration.h View File

@@ -1173,8 +1173,9 @@
1173 1173
 //#define LCD_BED_LEVELING
1174 1174
 
1175 1175
 #if ENABLED(LCD_BED_LEVELING)
1176
-  #define MBL_Z_STEP 0.025    // Step size while manually probing Z axis.
1177
-  #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
1176
+  #define MESH_EDIT_Z_STEP  0.025 // (mm) Step size while manually probing Z axis.
1177
+  #define LCD_PROBE_Z_RANGE 4     // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
1178
+  //#define MESH_EDIT_MENU        // Add a menu to edit mesh points
1178 1179
 #endif
1179 1180
 
1180 1181
 // Add a menu item to move between bed corners for manual bed adjustment

+ 3
- 2
Marlin/src/config/default/Configuration.h View File

@@ -1173,8 +1173,9 @@
1173 1173
 //#define LCD_BED_LEVELING
1174 1174
 
1175 1175
 #if ENABLED(LCD_BED_LEVELING)
1176
-  #define MBL_Z_STEP 0.025    // Step size while manually probing Z axis.
1177
-  #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
1176
+  #define MESH_EDIT_Z_STEP  0.025 // (mm) Step size while manually probing Z axis.
1177
+  #define LCD_PROBE_Z_RANGE 4     // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
1178
+  //#define MESH_EDIT_MENU        // Add a menu to edit mesh points
1178 1179
 #endif
1179 1180
 
1180 1181
 // Add a menu item to move between bed corners for manual bed adjustment

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

@@ -319,6 +319,8 @@
319 319
   #error "SWITCHING_TOOLHEAD_SECURITY_RAISE is now TOOLCHANGE_ZRAISE. Please update your configuration."
320 320
 #elif defined(G0_FEEDRATE) && G0_FEEDRATE == 0
321 321
   #error "G0_FEEDRATE is now used to set the G0 feedrate. Please update your configuration."
322
+#elif defined(MBL_Z_STEP)
323
+  #error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration."
322 324
 #endif
323 325
 
324 326
 #define BOARD_MKS_13     -47

+ 9
- 0
Marlin/src/lcd/language/language_en.h View File

@@ -192,6 +192,15 @@
192 192
 #ifndef MSG_EDITING_STOPPED
193 193
   #define MSG_EDITING_STOPPED                 _UxGT("Mesh Editing Stopped")
194 194
 #endif
195
+#ifndef MSG_MESH_X
196
+  #define MSG_MESH_X                          _UxGT("Index X")
197
+#endif
198
+#ifndef MSG_MESH_Y
199
+  #define MSG_MESH_Y                          _UxGT("Index Y")
200
+#endif
201
+#ifndef MSG_MESH_EDIT_Z
202
+  #define MSG_MESH_EDIT_Z                     _UxGT("Z Value")
203
+#endif
195 204
 #ifndef MSG_USER_MENU
196 205
   #define MSG_USER_MENU                       _UxGT("Custom Commands")
197 206
 #endif

+ 25
- 2
Marlin/src/lcd/menu/menu_bed_leveling.cpp View File

@@ -120,7 +120,7 @@
120 120
     // Encoder knob or keypad buttons adjust the Z position
121 121
     //
122 122
     if (encoderPosition) {
123
-      const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP);
123
+      const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MESH_EDIT_Z_STEP);
124 124
       line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f));
125 125
       lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
126 126
       encoderPosition = 0;
@@ -199,6 +199,25 @@
199 199
 
200 200
 #endif // PROBE_MANUALLY || MESH_BED_LEVELING
201 201
 
202
+#if ENABLED(MESH_EDIT_MENU)
203
+
204
+  inline void refresh_planner() {
205
+    set_current_from_steppers_for_axis(ALL_AXES);
206
+    sync_plan_position();
207
+  }
208
+
209
+  void menu_mbl_edit_mesh() {
210
+    static uint8_t xind, yind; // =0
211
+    START_MENU();
212
+    MENU_BACK(MSG_BED_LEVELING);
213
+    MENU_ITEM_EDIT(int8, MSG_MESH_X, &xind, 0, GRID_MAX_POINTS_X - 1);
214
+    MENU_ITEM_EDIT(int8, MSG_MESH_Y, &yind, 0, GRID_MAX_POINTS_Y - 1);
215
+    MENU_ITEM_EDIT_CALLBACK(float43, MSG_MESH_EDIT_Z, &Z_VALUES(xind, yind), -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner);
216
+    END_MENU();
217
+  }
218
+
219
+#endif // MESH_EDIT_MENU
220
+
202 221
 /**
203 222
  * Step 1: Bed Level entry-point
204 223
  *
@@ -233,6 +252,10 @@ void menu_bed_leveling() {
233 252
     MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29"));
234 253
   #endif
235 254
 
255
+  #if ENABLED(MESH_EDIT_MENU)
256
+    MENU_ITEM(submenu, MSG_EDIT_MESH, menu_mbl_edit_mesh);
257
+  #endif
258
+
236 259
   // Homed and leveling is valid? Then leveling can be toggled.
237 260
   if (is_homed && leveling_is_valid()) {
238 261
     bool new_level_state = planner.leveling_active;
@@ -245,7 +268,7 @@ void menu_bed_leveling() {
245 268
   #endif
246 269
 
247 270
   //
248
-  // MBL Z Offset
271
+  // Mesh Bed Leveling Z-Offset
249 272
   //
250 273
   #if ENABLED(MESH_BED_LEVELING)
251 274
     MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);

+ 2
- 2
buildroot/share/tests/megaatmega2560_tests View File

@@ -84,7 +84,7 @@ exec_test $1 $2 "RAMPS with Servo Probe, 3-Point ABL, DEBUG_LEVELING_FEATURE, EE
84 84
 # Test MESH_BED_LEVELING feature, with LCD
85 85
 #
86 86
 restore_configs
87
-opt_enable MESH_BED_LEVELING G26_MESH_EDITING MESH_G28_REST_ORIGIN LCD_BED_LEVELING ULTIMAKERCONTROLLER
87
+opt_enable MESH_BED_LEVELING G26_MESH_EDITING MESH_G28_REST_ORIGIN LCD_BED_LEVELING MESH_EDIT_MENU ULTIMAKERCONTROLLER
88 88
 exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD"
89 89
 
90 90
 #
@@ -92,7 +92,7 @@ exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD"
92 92
 #
93 93
 restore_configs
94 94
 opt_set MOTHERBOARD BOARD_MINIRAMBO
95
-opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING \
95
+opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING MESH_EDIT_MENU \
96 96
            EEPROM_SETTINGS EEPROM_CHITCHAT \
97 97
            M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR \
98 98
            INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \

Loading…
Cancel
Save