|
@@ -26,7 +26,7 @@
|
26
|
26
|
|
27
|
27
|
#include "../../inc/MarlinConfigPre.h"
|
28
|
28
|
|
29
|
|
-#if BOTH(HAS_MARLINUI_MENU, LEVEL_BED_CORNERS)
|
|
29
|
+#if BOTH(HAS_MARLINUI_MENU, LCD_BED_TRAMMING)
|
30
|
30
|
|
31
|
31
|
#include "menu_item.h"
|
32
|
32
|
#include "../../module/motion.h"
|
|
@@ -36,21 +36,21 @@
|
36
|
36
|
#include "../../feature/bedlevel/bedlevel.h"
|
37
|
37
|
#endif
|
38
|
38
|
|
39
|
|
-#ifndef LEVEL_CORNERS_Z_HOP
|
40
|
|
- #define LEVEL_CORNERS_Z_HOP 4.0
|
|
39
|
+#ifndef BED_TRAMMING_Z_HOP
|
|
40
|
+ #define BED_TRAMMING_Z_HOP 4.0
|
41
|
41
|
#endif
|
42
|
|
-#ifndef LEVEL_CORNERS_HEIGHT
|
43
|
|
- #define LEVEL_CORNERS_HEIGHT 0.0
|
|
42
|
+#ifndef BED_TRAMMING_HEIGHT
|
|
43
|
+ #define BED_TRAMMING_HEIGHT 0.0
|
44
|
44
|
#endif
|
45
|
45
|
|
46
|
|
-#if ENABLED(LEVEL_CORNERS_USE_PROBE)
|
|
46
|
+#if ENABLED(BED_TRAMMING_USE_PROBE)
|
47
|
47
|
#include "../../module/probe.h"
|
48
|
48
|
#include "../../module/endstops.h"
|
49
|
49
|
#if ENABLED(BLTOUCH)
|
50
|
50
|
#include "../../feature/bltouch.h"
|
51
|
51
|
#endif
|
52
|
|
- #ifndef LEVEL_CORNERS_PROBE_TOLERANCE
|
53
|
|
- #define LEVEL_CORNERS_PROBE_TOLERANCE 0.2
|
|
52
|
+ #ifndef BED_TRAMMING_PROBE_TOLERANCE
|
|
53
|
+ #define BED_TRAMMING_PROBE_TOLERANCE 0.2
|
54
|
54
|
#endif
|
55
|
55
|
float last_z;
|
56
|
56
|
int good_points;
|
|
@@ -64,32 +64,32 @@
|
64
|
64
|
|
65
|
65
|
#endif
|
66
|
66
|
|
67
|
|
-static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration.");
|
|
67
|
+static_assert(BED_TRAMMING_Z_HOP >= 0, "BED_TRAMMING_Z_HOP must be >= 0. Please update your configuration.");
|
68
|
68
|
|
69
|
|
-#ifndef LEVEL_CORNERS_LEVELING_ORDER
|
70
|
|
- #define LEVEL_CORNERS_LEVELING_ORDER { LF, RF, LB, RB } // Default
|
71
|
|
- //#define LEVEL_CORNERS_LEVELING_ORDER { LF, LB, RF } // 3 hard-coded points
|
72
|
|
- //#define LEVEL_CORNERS_LEVELING_ORDER { LF, RF } // 3-Point tramming - Rear
|
73
|
|
- //#define LEVEL_CORNERS_LEVELING_ORDER { LF, LB } // 3-Point tramming - Right
|
74
|
|
- //#define LEVEL_CORNERS_LEVELING_ORDER { RF, RB } // 3-Point tramming - Left
|
75
|
|
- //#define LEVEL_CORNERS_LEVELING_ORDER { LB, RB } // 3-Point tramming - Front
|
|
69
|
+#ifndef BED_TRAMMING_LEVELING_ORDER
|
|
70
|
+ #define BED_TRAMMING_LEVELING_ORDER { LF, RF, LB, RB } // Default
|
|
71
|
+ //#define BED_TRAMMING_LEVELING_ORDER { LF, LB, RF } // 3 hard-coded points
|
|
72
|
+ //#define BED_TRAMMING_LEVELING_ORDER { LF, RF } // 3-Point tramming - Rear
|
|
73
|
+ //#define BED_TRAMMING_LEVELING_ORDER { LF, LB } // 3-Point tramming - Right
|
|
74
|
+ //#define BED_TRAMMING_LEVELING_ORDER { RF, RB } // 3-Point tramming - Left
|
|
75
|
+ //#define BED_TRAMMING_LEVELING_ORDER { LB, RB } // 3-Point tramming - Front
|
76
|
76
|
#endif
|
77
|
77
|
|
78
|
78
|
#define LF 1
|
79
|
79
|
#define RF 2
|
80
|
80
|
#define RB 3
|
81
|
81
|
#define LB 4
|
82
|
|
-constexpr int lco[] = LEVEL_CORNERS_LEVELING_ORDER;
|
|
82
|
+constexpr int lco[] = BED_TRAMMING_LEVELING_ORDER;
|
83
|
83
|
constexpr bool level_corners_3_points = COUNT(lco) == 2;
|
84
|
|
-static_assert(level_corners_3_points || COUNT(lco) == 4, "LEVEL_CORNERS_LEVELING_ORDER must have exactly 2 or 4 corners.");
|
|
84
|
+static_assert(level_corners_3_points || COUNT(lco) == 4, "BED_TRAMMING_LEVELING_ORDER must have exactly 2 or 4 corners.");
|
85
|
85
|
|
86
|
86
|
constexpr int lcodiff = ABS(lco[0] - lco[1]);
|
87
|
|
-static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two LEVEL_CORNERS_LEVELING_ORDER corners must be on the same edge.");
|
|
87
|
+static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two BED_TRAMMING_LEVELING_ORDER corners must be on the same edge.");
|
88
|
88
|
|
89
|
89
|
constexpr int nr_edge_points = level_corners_3_points ? 3 : 4;
|
90
|
|
-constexpr int available_points = nr_edge_points + ENABLED(LEVEL_CENTER_TOO);
|
91
|
|
-constexpr int center_index = TERN(LEVEL_CENTER_TOO, available_points - 1, -1);
|
92
|
|
-constexpr float inset_lfrb[4] = LEVEL_CORNERS_INSET_LFRB;
|
|
90
|
+constexpr int available_points = nr_edge_points + ENABLED(BED_TRAMMING_INCLUDE_CENTER);
|
|
91
|
+constexpr int center_index = TERN(BED_TRAMMING_INCLUDE_CENTER, available_points - 1, -1);
|
|
92
|
+constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
93
|
93
|
constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] },
|
94
|
94
|
rb { (X_MAX_BED) - inset_lfrb[2], (Y_MAX_BED) - inset_lfrb[3] };
|
95
|
95
|
|
|
@@ -120,12 +120,12 @@ static void _lcd_level_bed_corners_get_next_position() {
|
120
|
120
|
if ((lco[0] == LF && lco[1] == LB) || (lco[0] == LB && lco[1] == LF)) current_position.x = rb.x; // Center Right
|
121
|
121
|
if ((lco[0] == RF && lco[1] == RB) || (lco[0] == RB && lco[1] == RF)) current_position.x = lf.x; // Left Center
|
122
|
122
|
if ((lco[0] == LF && lco[1] == RF) || (lco[0] == RF && lco[1] == LF)) current_position.y = rb.y; // Center Back
|
123
|
|
- #if DISABLED(LEVEL_CENTER_TOO) && ENABLED(LEVEL_CORNERS_USE_PROBE)
|
|
123
|
+ #if DISABLED(BED_TRAMMING_INCLUDE_CENTER) && ENABLED(BED_TRAMMING_USE_PROBE)
|
124
|
124
|
bed_corner++; // Must increment the count to ensure it resets the loop if the 3rd point is out of tolerance
|
125
|
125
|
#endif
|
126
|
126
|
break;
|
127
|
127
|
|
128
|
|
- #if ENABLED(LEVEL_CENTER_TOO)
|
|
128
|
+ #if ENABLED(BED_TRAMMING_INCLUDE_CENTER)
|
129
|
129
|
case 3:
|
130
|
130
|
current_position.set(X_CENTER, Y_CENTER);
|
131
|
131
|
break;
|
|
@@ -134,9 +134,9 @@ static void _lcd_level_bed_corners_get_next_position() {
|
134
|
134
|
}
|
135
|
135
|
else {
|
136
|
136
|
// Four-Corner Bed Tramming with optional center
|
137
|
|
- if (TERN0(LEVEL_CENTER_TOO, bed_corner == center_index)) {
|
|
137
|
+ if (TERN0(BED_TRAMMING_INCLUDE_CENTER, bed_corner == center_index)) {
|
138
|
138
|
current_position.set(X_CENTER, Y_CENTER);
|
139
|
|
- TERN_(LEVEL_CORNERS_USE_PROBE, good_points--); // Decrement to allow one additional probe point
|
|
139
|
+ TERN_(BED_TRAMMING_USE_PROBE, good_points--); // Decrement to allow one additional probe point
|
140
|
140
|
}
|
141
|
141
|
else {
|
142
|
142
|
current_position = lf; // Left front
|
|
@@ -152,10 +152,10 @@ static void _lcd_level_bed_corners_get_next_position() {
|
152
|
152
|
/**
|
153
|
153
|
* Level corners, starting in the front-left corner.
|
154
|
154
|
*/
|
155
|
|
-#if ENABLED(LEVEL_CORNERS_USE_PROBE)
|
|
155
|
+#if ENABLED(BED_TRAMMING_USE_PROBE)
|
156
|
156
|
|
157
|
157
|
#define VALIDATE_POINT(X, Y, STR) static_assert(Probe::build_time::can_reach((X), (Y)), \
|
158
|
|
- "LEVEL_CORNERS_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
|
158
|
+ "BED_TRAMMING_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
159
|
159
|
VALIDATE_POINT(lf.x, Y_CENTER, "left"); VALIDATE_POINT(X_CENTER, lf.y, "front");
|
160
|
160
|
VALIDATE_POINT(rb.x, Y_CENTER, "right"); VALIDATE_POINT(X_CENTER, rb.y, "back");
|
161
|
161
|
|
|
@@ -216,16 +216,16 @@ static void _lcd_level_bed_corners_get_next_position() {
|
216
|
216
|
}
|
217
|
217
|
|
218
|
218
|
bool _lcd_level_bed_corners_probe(bool verify=false) {
|
219
|
|
- if (verify) do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP); // do clearance if needed
|
|
219
|
+ if (verify) do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP); // do clearance if needed
|
220
|
220
|
TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.deploy()); // Deploy in LOW SPEED MODE on every probe action
|
221
|
|
- do_blocking_move_to_z(last_z - LEVEL_CORNERS_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance
|
|
221
|
+ do_blocking_move_to_z(last_z - BED_TRAMMING_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance
|
222
|
222
|
if (TEST(endstops.trigger_state(), Z_MIN_PROBE)) { // check if probe triggered
|
223
|
223
|
endstops.hit_on_purpose();
|
224
|
224
|
set_current_from_steppers_for_axis(Z_AXIS);
|
225
|
225
|
sync_plan_position();
|
226
|
226
|
TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.stow()); // Stow in LOW SPEED MODE on every trigger
|
227
|
227
|
// Triggered outside tolerance range?
|
228
|
|
- if (ABS(current_position.z - last_z) > LEVEL_CORNERS_PROBE_TOLERANCE) {
|
|
228
|
+ if (ABS(current_position.z - last_z) > BED_TRAMMING_PROBE_TOLERANCE) {
|
229
|
229
|
last_z = current_position.z; // Above tolerance. Set a new Z for subsequent corners.
|
230
|
230
|
good_points = 0; // ...and start over
|
231
|
231
|
}
|
|
@@ -245,7 +245,7 @@ static void _lcd_level_bed_corners_get_next_position() {
|
245
|
245
|
probe_triggered = PROBE_TRIGGERED();
|
246
|
246
|
if (probe_triggered) {
|
247
|
247
|
endstops.hit_on_purpose();
|
248
|
|
- TERN_(LEVEL_CORNERS_AUDIO_FEEDBACK, BUZZ(200, 600));
|
|
248
|
+ TERN_(BED_TRAMMING_AUDIO_FEEDBACK, BUZZ(200, 600));
|
249
|
249
|
}
|
250
|
250
|
idle();
|
251
|
251
|
}
|
|
@@ -255,8 +255,8 @@ static void _lcd_level_bed_corners_get_next_position() {
|
255
|
255
|
}
|
256
|
256
|
|
257
|
257
|
void _lcd_test_corners() {
|
258
|
|
- bed_corner = TERN(LEVEL_CENTER_TOO, center_index, 0);
|
259
|
|
- last_z = LEVEL_CORNERS_HEIGHT;
|
|
258
|
+ bed_corner = TERN(BED_TRAMMING_INCLUDE_CENTER, center_index, 0);
|
|
259
|
+ last_z = BED_TRAMMING_HEIGHT;
|
260
|
260
|
endstops.enable_z_probe(true);
|
261
|
261
|
good_points = 0;
|
262
|
262
|
ui.goto_screen(_lcd_draw_probing);
|
|
@@ -264,7 +264,7 @@ static void _lcd_level_bed_corners_get_next_position() {
|
264
|
264
|
ui.refresh(LCDVIEW_REDRAW_NOW);
|
265
|
265
|
_lcd_draw_probing(); // update screen with # of good points
|
266
|
266
|
|
267
|
|
- do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP + TERN0(BLTOUCH, bltouch.z_extra_clearance())); // clearance
|
|
267
|
+ do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP + TERN0(BLTOUCH, bltouch.z_extra_clearance())); // clearance
|
268
|
268
|
|
269
|
269
|
_lcd_level_bed_corners_get_next_position(); // Select next corner coordinates
|
270
|
270
|
current_position -= probe.offset_xy; // Account for probe offsets
|
|
@@ -273,7 +273,7 @@ static void _lcd_level_bed_corners_get_next_position() {
|
273
|
273
|
TERN_(BLTOUCH, if (bltouch.high_speed_mode) bltouch.deploy()); // Deploy in HIGH SPEED MODE
|
274
|
274
|
if (!_lcd_level_bed_corners_probe()) { // Probe down to tolerance
|
275
|
275
|
if (_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed
|
276
|
|
- #if ENABLED(LEVEL_CORNERS_VERIFY_RAISED) // Verify
|
|
276
|
+ #if ENABLED(BED_TRAMMING_VERIFY_RAISED) // Verify
|
277
|
277
|
while (!_lcd_level_bed_corners_probe(true)) { // Loop while corner verified
|
278
|
278
|
if (!_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed
|
279
|
279
|
if (corner_probing_done) return; // Done was selected
|
|
@@ -294,7 +294,7 @@ static void _lcd_level_bed_corners_get_next_position() {
|
294
|
294
|
#if ENABLED(BLTOUCH)
|
295
|
295
|
if (bltouch.high_speed_mode) {
|
296
|
296
|
// In HIGH SPEED MODE do clearance and stow at the very end
|
297
|
|
- do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP);
|
|
297
|
+ do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP);
|
298
|
298
|
bltouch.stow();
|
299
|
299
|
}
|
300
|
300
|
#endif
|
|
@@ -303,25 +303,25 @@ static void _lcd_level_bed_corners_get_next_position() {
|
303
|
303
|
ui.set_selection(true);
|
304
|
304
|
}
|
305
|
305
|
|
306
|
|
-#else // !LEVEL_CORNERS_USE_PROBE
|
|
306
|
+#else // !BED_TRAMMING_USE_PROBE
|
307
|
307
|
|
308
|
308
|
static void _lcd_goto_next_corner() {
|
309
|
|
- line_to_z(LEVEL_CORNERS_Z_HOP);
|
|
309
|
+ line_to_z(BED_TRAMMING_Z_HOP);
|
310
|
310
|
|
311
|
311
|
// Select next corner coordinates
|
312
|
312
|
_lcd_level_bed_corners_get_next_position();
|
313
|
313
|
|
314
|
314
|
line_to_current_position(manual_feedrate_mm_s.x);
|
315
|
|
- line_to_z(LEVEL_CORNERS_HEIGHT);
|
|
315
|
+ line_to_z(BED_TRAMMING_HEIGHT);
|
316
|
316
|
if (++bed_corner >= available_points) bed_corner = 0;
|
317
|
317
|
}
|
318
|
318
|
|
319
|
|
-#endif // !LEVEL_CORNERS_USE_PROBE
|
|
319
|
+#endif // !BED_TRAMMING_USE_PROBE
|
320
|
320
|
|
321
|
321
|
static void _lcd_level_bed_corners_homing() {
|
322
|
322
|
_lcd_draw_homing();
|
323
|
323
|
if (!all_axes_homed()) return;
|
324
|
|
- #if ENABLED(LEVEL_CORNERS_USE_PROBE)
|
|
324
|
+ #if ENABLED(BED_TRAMMING_USE_PROBE)
|
325
|
325
|
_lcd_test_corners();
|
326
|
326
|
if (corner_probing_done) ui.goto_previous_screen_no_defer();
|
327
|
327
|
TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active));
|
|
@@ -333,11 +333,11 @@ static void _lcd_level_bed_corners_homing() {
|
333
|
333
|
GET_TEXT_F(MSG_BUTTON_NEXT), GET_TEXT_F(MSG_BUTTON_DONE)
|
334
|
334
|
, _lcd_goto_next_corner
|
335
|
335
|
, []{
|
336
|
|
- line_to_z(LEVEL_CORNERS_Z_HOP); // Raise Z off the bed when done
|
|
336
|
+ line_to_z(BED_TRAMMING_Z_HOP); // Raise Z off the bed when done
|
337
|
337
|
TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active));
|
338
|
338
|
ui.goto_previous_screen_no_defer();
|
339
|
339
|
}
|
340
|
|
- , GET_TEXT_F(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER))
|
|
340
|
+ , GET_TEXT_F(TERN(BED_TRAMMING_INCLUDE_CENTER, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER))
|
341
|
341
|
, (const char*)nullptr, F("?")
|
342
|
342
|
);
|
343
|
343
|
});
|
|
@@ -362,4 +362,4 @@ void _lcd_level_bed_corners() {
|
362
|
362
|
ui.goto_screen(_lcd_level_bed_corners_homing);
|
363
|
363
|
}
|
364
|
364
|
|
365
|
|
-#endif // HAS_MARLINUI_MENU && LEVEL_BED_CORNERS
|
|
365
|
+#endif // HAS_MARLINUI_MENU && LCD_BED_TRAMMING
|