Browse Source

Merge pull request #12286 from thinkyhead/bf2_menu_bed_corners

Fix LEVEL_BED_CORNERS menu not found
Scott Lahteine 6 years ago
parent
commit
724c2ed9b4
No account linked to committer's email address

+ 0
- 11
Marlin/src/Marlin.cpp View File

@@ -160,17 +160,6 @@
160 160
 
161 161
 bool Running = true;
162 162
 
163
-/**
164
- * axis_homed
165
- *   Flags that each linear axis was homed.
166
- *   XYZ on cartesian, ABC on delta, ABZ on SCARA.
167
- *
168
- * axis_known_position
169
- *   Flags that the position is known in each linear axis. Set when homed.
170
- *   Cleared whenever a stepper powers off, potentially losing its position.
171
- */
172
-uint8_t axis_homed, axis_known_position; // = 0
173
-
174 163
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
175 164
   TempUnit input_temp_units = TEMPUNIT_C;
176 165
 #endif

+ 0
- 6
Marlin/src/Marlin.h View File

@@ -189,12 +189,6 @@ extern bool Running;
189 189
 inline bool IsRunning() { return  Running; }
190 190
 inline bool IsStopped() { return !Running; }
191 191
 
192
-extern uint8_t axis_homed, axis_known_position;
193
-
194
-constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
195
-FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
196
-FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
197
-
198 192
 extern volatile bool wait_for_heatup;
199 193
 
200 194
 #if HAS_RESUME_CONTINUE

+ 0
- 1
Marlin/src/gcode/geometry/M206_M428.cpp View File

@@ -28,7 +28,6 @@
28 28
 #include "../../module/motion.h"
29 29
 #include "../../lcd/ultralcd.h"
30 30
 #include "../../libs/buzzer.h"
31
-#include "../../Marlin.h" // for axis_homed
32 31
 
33 32
 /**
34 33
  * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y

+ 8
- 5
Marlin/src/lcd/extensible_ui/ui_api.cpp View File

@@ -41,7 +41,7 @@
41 41
  *   location: <http://www.gnu.org/licenses/>.                              *
42 42
  ****************************************************************************/
43 43
 
44
-#include "../../Marlin.h"
44
+#include "../../inc/MarlinConfigPre.h"
45 45
 
46 46
 #if ENABLED(EXTENSIBLE_UI)
47 47
 
@@ -109,7 +109,7 @@ namespace UI {
109 109
       // Machine was killed, reinit SysTick so we are able to compute time without ISRs
110 110
       if (currTimeHI == 0) {
111 111
         // Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
112
-        currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU/8000)) >> 24);
112
+        currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU / 8000)) >> 24);
113 113
 
114 114
         // Reinit the SysTick timer to maximize its period
115 115
         SysTick->LOAD  = SysTick_LOAD_RELOAD_Msk;                    // get the full range for the systick timer
@@ -136,7 +136,7 @@ namespace UI {
136 136
   #else
137 137
 
138 138
     // TODO: Implement for AVR
139
-    uint32_t safe_millis() { return millis(); }
139
+    FORCE_INLINE uint32_t safe_millis() { return millis(); }
140 140
 
141 141
   #endif
142 142
 
@@ -399,6 +399,7 @@ namespace UI {
399 399
   #endif
400 400
 
401 401
   #if ENABLED(JUNCTION_DEVIATION)
402
+
402 403
     float getJunctionDeviation_mm() {
403 404
       return planner.junction_deviation_mm;
404 405
     }
@@ -407,13 +408,15 @@ namespace UI {
407 408
       planner.junction_deviation_mm = clamp(value, 0.01, 0.3);
408 409
       planner.recalculate_max_e_jerk();
409 410
     }
411
+
410 412
   #else
413
+
411 414
     float getAxisMaxJerk_mm_s(const axis_t axis) {
412
-        return planner.max_jerk[axis];
415
+      return planner.max_jerk[axis];
413 416
     }
414 417
 
415 418
     float getAxisMaxJerk_mm_s(const extruder_t extruder) {
416
-        return planner.max_jerk[E_AXIS];
419
+      return planner.max_jerk[E_AXIS];
417 420
     }
418 421
 
419 422
     void setAxisMaxJerk_mm_s(const float value, const axis_t axis) {

+ 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

+ 1
- 73
Marlin/src/lcd/menu/menu_bed_leveling.cpp View File

@@ -188,84 +188,13 @@
188 188
   //
189 189
   void _lcd_level_bed_continue() {
190 190
     defer_return_to_status = true;
191
-    axis_homed = 0;
191
+    set_all_unhomed();
192 192
     lcd_goto_screen(_lcd_level_bed_homing);
193 193
     enqueue_and_echo_commands_P(PSTR("G28"));
194 194
   }
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
 

+ 1
- 1
Marlin/src/lcd/menu/menu_ubl.cpp View File

@@ -502,7 +502,7 @@ void _lcd_ubl_output_map_lcd() {
502 502
  */
503 503
 void _lcd_ubl_output_map_lcd_cmd() {
504 504
   if (!all_axes_known()) {
505
-    axis_homed = 0;
505
+    set_all_unhomed();
506 506
     enqueue_and_echo_commands_P(PSTR("G28"));
507 507
   }
508 508
   lcd_goto_screen(_lcd_ubl_map_homing);

+ 1
- 1
Marlin/src/module/delta.cpp View File

@@ -73,7 +73,7 @@ void recalc_delta_settings() {
73 73
   delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
74 74
   delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
75 75
   update_software_endstops(Z_AXIS);
76
-  axis_homed = 0;
76
+  set_all_unhomed();
77 77
 }
78 78
 
79 79
 /**

+ 11
- 0
Marlin/src/module/motion.cpp View File

@@ -68,6 +68,17 @@ XYZ_CONSTS(float, max_length,     MAX_LENGTH);
68 68
 XYZ_CONSTS(float, home_bump_mm,   HOME_BUMP_MM);
69 69
 XYZ_CONSTS(signed char, home_dir, HOME_DIR);
70 70
 
71
+/**
72
+ * axis_homed
73
+ *   Flags that each linear axis was homed.
74
+ *   XYZ on cartesian, ABC on delta, ABZ on SCARA.
75
+ *
76
+ * axis_known_position
77
+ *   Flags that the position is known in each linear axis. Set when homed.
78
+ *   Cleared whenever a stepper powers off, potentially losing its position.
79
+ */
80
+uint8_t axis_homed, axis_known_position; // = 0
81
+
71 82
 // Relative Mode. Enable with G91, disable with G90.
72 83
 bool relative_mode; // = false;
73 84
 

+ 9
- 5
Marlin/src/module/motion.h View File

@@ -26,9 +26,7 @@
26 26
  * High-level motion commands to feed the planner
27 27
  * Some of these methods may migrate to the planner class.
28 28
  */
29
-
30
-#ifndef MOTION_H
31
-#define MOTION_H
29
+#pragma once
32 30
 
33 31
 #include "../inc/MarlinConfig.h"
34 32
 
@@ -36,6 +34,14 @@
36 34
   #include "../module/scara.h"
37 35
 #endif
38 36
 
37
+// Axis homed and known-position states
38
+extern uint8_t axis_homed, axis_known_position;
39
+constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
40
+FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
41
+FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
42
+FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
43
+FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
44
+
39 45
 // Error margin to work around float imprecision
40 46
 constexpr float slop = 0.0001;
41 47
 
@@ -359,5 +365,3 @@ void homeaxis(const AxisEnum axis);
359 365
 #if HAS_M206_COMMAND
360 366
   void set_home_offset(const AxisEnum axis, const float v);
361 367
 #endif
362
-
363
-#endif // MOTION_H

Loading…
Cancel
Save