|
@@ -32,6 +32,10 @@
|
32
|
32
|
#include "../../module/motion.h"
|
33
|
33
|
#include "../../module/planner.h"
|
34
|
34
|
|
|
35
|
+#if HAS_LEVELING
|
|
36
|
+ #include "../../feature/bedlevel/bedlevel.h"
|
|
37
|
+#endif
|
|
38
|
+
|
35
|
39
|
#ifndef LEVEL_CORNERS_Z_HOP
|
36
|
40
|
#define LEVEL_CORNERS_Z_HOP 4.0
|
37
|
41
|
#endif
|
|
@@ -42,11 +46,22 @@
|
42
|
46
|
|
43
|
47
|
static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration.");
|
44
|
48
|
|
|
49
|
+#if HAS_LEVELING
|
|
50
|
+ static bool leveling_was_active = false;
|
|
51
|
+#endif
|
|
52
|
+
|
|
53
|
+static inline void _lcd_level_bed_corners_back() {
|
|
54
|
+ #if HAS_LEVELING
|
|
55
|
+ set_bed_leveling_enabled(leveling_was_active);
|
|
56
|
+ #endif
|
|
57
|
+ ui.goto_previous_screen_no_defer();
|
|
58
|
+}
|
|
59
|
+
|
45
|
60
|
/**
|
46
|
61
|
* Level corners, starting in the front-left corner.
|
47
|
62
|
*/
|
48
|
63
|
static int8_t bed_corner;
|
49
|
|
-void _lcd_goto_next_corner() {
|
|
64
|
+static inline void _lcd_goto_next_corner() {
|
50
|
65
|
line_to_z(LEVEL_CORNERS_Z_HOP);
|
51
|
66
|
switch (bed_corner) {
|
52
|
67
|
case 0:
|
|
@@ -78,7 +93,7 @@ void _lcd_goto_next_corner() {
|
78
|
93
|
) bed_corner = 0;
|
79
|
94
|
}
|
80
|
95
|
|
81
|
|
-void menu_level_bed_corners() {
|
|
96
|
+static inline void menu_level_bed_corners() {
|
82
|
97
|
START_MENU();
|
83
|
98
|
MENU_ITEM(function,
|
84
|
99
|
#if ENABLED(LEVEL_CENTER_TOO)
|
|
@@ -86,12 +101,13 @@ void menu_level_bed_corners() {
|
86
|
101
|
#else
|
87
|
102
|
MSG_NEXT_CORNER
|
88
|
103
|
#endif
|
89
|
|
- , _lcd_goto_next_corner);
|
90
|
|
- MENU_ITEM(function, MSG_BACK, ui.goto_previous_screen_no_defer);
|
|
104
|
+ , _lcd_goto_next_corner
|
|
105
|
+ );
|
|
106
|
+ MENU_ITEM(function, MSG_BACK, _lcd_level_bed_corners_back);
|
91
|
107
|
END_MENU();
|
92
|
108
|
}
|
93
|
109
|
|
94
|
|
-void _lcd_level_bed_corners_homing() {
|
|
110
|
+static inline void _lcd_level_bed_corners_homing() {
|
95
|
111
|
_lcd_draw_homing();
|
96
|
112
|
if (all_axes_homed()) {
|
97
|
113
|
bed_corner = 0;
|
|
@@ -106,6 +122,13 @@ void _lcd_level_bed_corners() {
|
106
|
122
|
set_all_unhomed();
|
107
|
123
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
108
|
124
|
}
|
|
125
|
+
|
|
126
|
+ // Disable leveling so the planner won't mess with us
|
|
127
|
+ #if HAS_LEVELING
|
|
128
|
+ leveling_was_active = planner.leveling_active;
|
|
129
|
+ set_bed_leveling_enabled(false);
|
|
130
|
+ #endif
|
|
131
|
+
|
109
|
132
|
ui.goto_screen(_lcd_level_bed_corners_homing);
|
110
|
133
|
}
|
111
|
134
|
|