Browse Source

Move axis_homed, axis_known_position to motion.*

Scott Lahteine 6 years ago
parent
commit
44f2a82a56

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

160
 
160
 
161
 bool Running = true;
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
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
163
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
175
   TempUnit input_temp_units = TEMPUNIT_C;
164
   TempUnit input_temp_units = TEMPUNIT_C;
176
 #endif
165
 #endif

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

189
 inline bool IsRunning() { return  Running; }
189
 inline bool IsRunning() { return  Running; }
190
 inline bool IsStopped() { return !Running; }
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
 extern volatile bool wait_for_heatup;
192
 extern volatile bool wait_for_heatup;
199
 
193
 
200
 #if HAS_RESUME_CONTINUE
194
 #if HAS_RESUME_CONTINUE

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

28
 #include "../../module/motion.h"
28
 #include "../../module/motion.h"
29
 #include "../../lcd/ultralcd.h"
29
 #include "../../lcd/ultralcd.h"
30
 #include "../../libs/buzzer.h"
30
 #include "../../libs/buzzer.h"
31
-#include "../../Marlin.h" // for axis_homed
32
 
31
 
33
 /**
32
 /**
34
  * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
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
  *   location: <http://www.gnu.org/licenses/>.                              *
41
  *   location: <http://www.gnu.org/licenses/>.                              *
42
  ****************************************************************************/
42
  ****************************************************************************/
43
 
43
 
44
-#include "../../Marlin.h"
44
+#include "../../inc/MarlinConfigPre.h"
45
 
45
 
46
 #if ENABLED(EXTENSIBLE_UI)
46
 #if ENABLED(EXTENSIBLE_UI)
47
 
47
 
109
       // Machine was killed, reinit SysTick so we are able to compute time without ISRs
109
       // Machine was killed, reinit SysTick so we are able to compute time without ISRs
110
       if (currTimeHI == 0) {
110
       if (currTimeHI == 0) {
111
         // Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
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
         // Reinit the SysTick timer to maximize its period
114
         // Reinit the SysTick timer to maximize its period
115
         SysTick->LOAD  = SysTick_LOAD_RELOAD_Msk;                    // get the full range for the systick timer
115
         SysTick->LOAD  = SysTick_LOAD_RELOAD_Msk;                    // get the full range for the systick timer
136
   #else
136
   #else
137
 
137
 
138
     // TODO: Implement for AVR
138
     // TODO: Implement for AVR
139
-    uint32_t safe_millis() { return millis(); }
139
+    FORCE_INLINE uint32_t safe_millis() { return millis(); }
140
 
140
 
141
   #endif
141
   #endif
142
 
142
 
399
   #endif
399
   #endif
400
 
400
 
401
   #if ENABLED(JUNCTION_DEVIATION)
401
   #if ENABLED(JUNCTION_DEVIATION)
402
+
402
     float getJunctionDeviation_mm() {
403
     float getJunctionDeviation_mm() {
403
       return planner.junction_deviation_mm;
404
       return planner.junction_deviation_mm;
404
     }
405
     }
407
       planner.junction_deviation_mm = clamp(value, 0.01, 0.3);
408
       planner.junction_deviation_mm = clamp(value, 0.01, 0.3);
408
       planner.recalculate_max_e_jerk();
409
       planner.recalculate_max_e_jerk();
409
     }
410
     }
411
+
410
   #else
412
   #else
413
+
411
     float getAxisMaxJerk_mm_s(const axis_t axis) {
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
     float getAxisMaxJerk_mm_s(const extruder_t extruder) {
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
     void setAxisMaxJerk_mm_s(const float value, const axis_t axis) {
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
   //
188
   //
189
   void _lcd_level_bed_continue() {
189
   void _lcd_level_bed_continue() {
190
     defer_return_to_status = true;
190
     defer_return_to_status = true;
191
-    axis_homed = 0;
191
+    set_all_unhomed();
192
     lcd_goto_screen(_lcd_level_bed_homing);
192
     lcd_goto_screen(_lcd_level_bed_homing);
193
     enqueue_and_echo_commands_P(PSTR("G28"));
193
     enqueue_and_echo_commands_P(PSTR("G28"));
194
   }
194
   }

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

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

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

73
   delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
73
   delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
74
   delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
74
   delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
75
   update_software_endstops(Z_AXIS);
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
 XYZ_CONSTS(float, home_bump_mm,   HOME_BUMP_MM);
68
 XYZ_CONSTS(float, home_bump_mm,   HOME_BUMP_MM);
69
 XYZ_CONSTS(signed char, home_dir, HOME_DIR);
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
 // Relative Mode. Enable with G91, disable with G90.
82
 // Relative Mode. Enable with G91, disable with G90.
72
 bool relative_mode; // = false;
83
 bool relative_mode; // = false;
73
 
84
 

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

26
  * High-level motion commands to feed the planner
26
  * High-level motion commands to feed the planner
27
  * Some of these methods may migrate to the planner class.
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
 #include "../inc/MarlinConfig.h"
31
 #include "../inc/MarlinConfig.h"
34
 
32
 
36
   #include "../module/scara.h"
34
   #include "../module/scara.h"
37
 #endif
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
 // Error margin to work around float imprecision
45
 // Error margin to work around float imprecision
40
 constexpr float slop = 0.0001;
46
 constexpr float slop = 0.0001;
41
 
47
 
359
 #if HAS_M206_COMMAND
365
 #if HAS_M206_COMMAND
360
   void set_home_offset(const AxisEnum axis, const float v);
366
   void set_home_offset(const AxisEnum axis, const float v);
361
 #endif
367
 #endif
362
-
363
-#endif // MOTION_H

Loading…
Cancel
Save