Browse Source

Move menu_level_bed_corners to its own file

Scott Lahteine 6 years ago
parent
commit
2cff0d1f39
2 changed files with 102 additions and 72 deletions
  1. 102
    0
      Marlin/src/lcd/menu/menu_bed_corners.cpp
  2. 0
    72
      Marlin/src/lcd/menu/menu_bed_leveling.cpp

+ 102
- 0
Marlin/src/lcd/menu/menu_bed_corners.cpp View File

@@ -0,0 +1,102 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+//
24
+// Level Bed Corners menu
25
+//
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#if HAS_LCD_MENU && ENABLED(LEVEL_BED_CORNERS)
30
+
31
+#include "menu.h"
32
+#include "../../module/motion.h"
33
+#include "../../module/planner.h"
34
+
35
+/**
36
+ * Level corners, starting in the front-left corner.
37
+ */
38
+static int8_t bed_corner;
39
+void _lcd_goto_next_corner() {
40
+  line_to_z(4.0);
41
+  switch (bed_corner) {
42
+    case 0:
43
+      current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
44
+      current_position[Y_AXIS] = Y_MIN_BED + LEVEL_CORNERS_INSET;
45
+      break;
46
+    case 1:
47
+      current_position[X_AXIS] = X_MAX_BED - LEVEL_CORNERS_INSET;
48
+      break;
49
+    case 2:
50
+      current_position[Y_AXIS] = Y_MAX_BED - LEVEL_CORNERS_INSET;
51
+      break;
52
+    case 3:
53
+      current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
54
+      break;
55
+    #if ENABLED(LEVEL_CENTER_TOO)
56
+      case 4:
57
+        current_position[X_AXIS] = X_CENTER;
58
+        current_position[Y_AXIS] = Y_CENTER;
59
+        break;
60
+    #endif
61
+  }
62
+  planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder);
63
+  line_to_z(0.0);
64
+  if (++bed_corner > 3
65
+    #if ENABLED(LEVEL_CENTER_TOO)
66
+      + 1
67
+    #endif
68
+  ) bed_corner = 0;
69
+}
70
+
71
+void menu_level_bed_corners() {
72
+  START_MENU();
73
+  MENU_ITEM(function,
74
+    #if ENABLED(LEVEL_CENTER_TOO)
75
+      MSG_LEVEL_BED_NEXT_POINT
76
+    #else
77
+      MSG_NEXT_CORNER
78
+    #endif
79
+    , _lcd_goto_next_corner);
80
+  MENU_ITEM(function, MSG_BACK, lcd_goto_previous_menu_no_defer);
81
+  END_MENU();
82
+}
83
+
84
+void _lcd_level_bed_corners_homing() {
85
+  _lcd_draw_homing();
86
+  if (all_axes_homed()) {
87
+    bed_corner = 0;
88
+    lcd_goto_screen(menu_level_bed_corners);
89
+    _lcd_goto_next_corner();
90
+  }
91
+}
92
+
93
+void _lcd_level_bed_corners() {
94
+  defer_return_to_status = true;
95
+  if (!all_axes_known()) {
96
+    set_all_unhomed();
97
+    enqueue_and_echo_commands_P(PSTR("G28"));
98
+  }
99
+  lcd_goto_screen(_lcd_level_bed_corners_homing);
100
+}
101
+
102
+#endif // HAS_LCD_MENU && LEVEL_BED_CORNERS

+ 0
- 72
Marlin/src/lcd/menu/menu_bed_leveling.cpp View File

@@ -195,77 +195,6 @@
195 195
 
196 196
 #endif // PROBE_MANUALLY || MESH_BED_LEVELING
197 197
 
198
-#if ENABLED(LEVEL_BED_CORNERS)
199
-
200
-  /**
201
-   * Level corners, starting in the front-left corner.
202
-   */
203
-  static int8_t bed_corner;
204
-  void _lcd_goto_next_corner() {
205
-    line_to_z(4.0);
206
-    switch (bed_corner) {
207
-      case 0:
208
-        current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
209
-        current_position[Y_AXIS] = Y_MIN_BED + LEVEL_CORNERS_INSET;
210
-        break;
211
-      case 1:
212
-        current_position[X_AXIS] = X_MAX_BED - LEVEL_CORNERS_INSET;
213
-        break;
214
-      case 2:
215
-        current_position[Y_AXIS] = Y_MAX_BED - LEVEL_CORNERS_INSET;
216
-        break;
217
-      case 3:
218
-        current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
219
-        break;
220
-      #if ENABLED(LEVEL_CENTER_TOO)
221
-        case 4:
222
-          current_position[X_AXIS] = X_CENTER;
223
-          current_position[Y_AXIS] = Y_CENTER;
224
-          break;
225
-      #endif
226
-    }
227
-    planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder);
228
-    line_to_z(0.0);
229
-    if (++bed_corner > 3
230
-      #if ENABLED(LEVEL_CENTER_TOO)
231
-        + 1
232
-      #endif
233
-    ) bed_corner = 0;
234
-  }
235
-
236
-  void _lcd_corner_submenu() {
237
-    START_MENU();
238
-    MENU_ITEM(function,
239
-      #if ENABLED(LEVEL_CENTER_TOO)
240
-        MSG_LEVEL_BED_NEXT_POINT
241
-      #else
242
-        MSG_NEXT_CORNER
243
-      #endif
244
-      , _lcd_goto_next_corner);
245
-    MENU_ITEM(function, MSG_BACK, lcd_goto_previous_menu_no_defer);
246
-    END_MENU();
247
-  }
248
-
249
-  void _lcd_level_bed_corners_homing() {
250
-    _lcd_draw_homing();
251
-    if (all_axes_homed()) {
252
-      bed_corner = 0;
253
-      lcd_goto_screen(_lcd_corner_submenu);
254
-      _lcd_goto_next_corner();
255
-    }
256
-  }
257
-
258
-  void _lcd_level_bed_corners() {
259
-    defer_return_to_status = true;
260
-    if (!all_axes_known()) {
261
-      axis_homed = 0;
262
-      enqueue_and_echo_commands_P(PSTR("G28"));
263
-    }
264
-    lcd_goto_screen(_lcd_level_bed_corners_homing);
265
-  }
266
-
267
-#endif // LEVEL_BED_CORNERS
268
-
269 198
 /**
270 199
  * Step 1: Bed Level entry-point
271 200
  *
@@ -325,7 +254,6 @@ void menu_bed_leveling() {
325 254
   #endif
326 255
 
327 256
   #if ENABLED(LEVEL_BED_CORNERS)
328
-    // Move to the next corner for leveling
329 257
     MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
330 258
   #endif
331 259
 

Loading…
Cancel
Save