|
@@ -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
|