Browse Source

Move axis_homed, axis_known_position to motion.*

Scott Lahteine 5 years ago
parent
commit
44f2a82a56

+ 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) {

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

@@ -188,7 +188,7 @@
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
   }

+ 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