Browse Source

Implement NO_MOTION_BEFORE_HOMING option

Scott Lahteine 7 years ago
parent
commit
90af1fe5ee

+ 2
- 0
Marlin/Configuration.h View File

760
 
760
 
761
 // @section homing
761
 // @section homing
762
 
762
 
763
+//#define NO_MOTION_BEFORE_HOMING  // Inhibit movement until all axes have been homed
764
+
763
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
765
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
764
                              // Be sure you have this distance over your Z_MAX_POS in case.
766
                              // Be sure you have this distance over your Z_MAX_POS in case.
765
 
767
 

+ 1
- 1
Marlin/src/gcode/bedlevel/G42.cpp View File

33
  * G42: Move X & Y axes to mesh coordinates (I & J)
33
  * G42: Move X & Y axes to mesh coordinates (I & J)
34
  */
34
  */
35
 void GcodeSuite::G42() {
35
 void GcodeSuite::G42() {
36
-  if (IsRunning()) {
36
+  if (MOTION_CONDITIONS) {
37
     const bool hasI = parser.seenval('I');
37
     const bool hasI = parser.seenval('I');
38
     const int8_t ix = hasI ? parser.value_int() : 0;
38
     const int8_t ix = hasI ? parser.value_int() : 0;
39
     const bool hasJ = parser.seenval('J');
39
     const bool hasJ = parser.seenval('J');

+ 1
- 1
Marlin/src/gcode/motion/G0_G1.cpp View File

41
     bool fast_move/*=false*/
41
     bool fast_move/*=false*/
42
   #endif
42
   #endif
43
 ) {
43
 ) {
44
-  if (IsRunning()) {
44
+  if (MOTION_CONDITIONS) {
45
     get_destination_from_command(); // For X Y Z E F
45
     get_destination_from_command(); // For X Y Z E F
46
 
46
 
47
     #if ENABLED(FWRETRACT)
47
     #if ENABLED(FWRETRACT)

+ 1
- 1
Marlin/src/gcode/motion/G2_G3.cpp View File

211
  *    G3 X20 Y12 R14   ; CCW circle with r=14 ending at X20 Y12
211
  *    G3 X20 Y12 R14   ; CCW circle with r=14 ending at X20 Y12
212
  */
212
  */
213
 void GcodeSuite::G2_G3(const bool clockwise) {
213
 void GcodeSuite::G2_G3(const bool clockwise) {
214
-  if (IsRunning()) {
214
+  if (MOTION_CONDITIONS) {
215
 
215
 
216
     #if ENABLED(SF_ARC_FIX)
216
     #if ENABLED(SF_ARC_FIX)
217
       const bool relative_mode_backup = relative_mode;
217
       const bool relative_mode_backup = relative_mode;

+ 1
- 1
Marlin/src/gcode/motion/G5.cpp View File

50
  * G5: Cubic B-spline
50
  * G5: Cubic B-spline
51
  */
51
  */
52
 void GcodeSuite::G5() {
52
 void GcodeSuite::G5() {
53
-  if (IsRunning()) {
53
+  if (MOTION_CONDITIONS) {
54
 
54
 
55
     #if ENABLED(CNC_WORKSPACE_PLANES)
55
     #if ENABLED(CNC_WORKSPACE_PLANES)
56
       if (workspace_plane != PLANE_XY) {
56
       if (workspace_plane != PLANE_XY) {

+ 10
- 10
Marlin/src/lcd/ultralcd.cpp View File

2928
    *
2928
    *
2929
    */
2929
    */
2930
 
2930
 
2931
-  #if IS_KINEMATIC
2931
+  #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
2932
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
2932
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
2933
-    #if ENABLED(DELTA)
2934
-      #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
2935
-      void lcd_lower_z_to_clip_height() {
2936
-        line_to_z(delta_clip_start_height);
2937
-        lcd_synchronize();
2938
-      }
2939
-    #else
2940
-      #define _MOVE_XY_ALLOWED true
2941
-    #endif
2942
   #else
2933
   #else
2943
     #define _MOVE_XYZ_ALLOWED true
2934
     #define _MOVE_XYZ_ALLOWED true
2935
+  #endif
2936
+
2937
+  #if ENABLED(DELTA)
2938
+    #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
2939
+    void lcd_lower_z_to_clip_height() {
2940
+      line_to_z(delta_clip_start_height);
2941
+      lcd_synchronize();
2942
+    }
2943
+  #else
2944
     #define _MOVE_XY_ALLOWED true
2944
     #define _MOVE_XY_ALLOWED true
2945
   #endif
2945
   #endif
2946
 
2946
 

+ 3
- 3
Marlin/src/module/motion.cpp View File

51
   #include "../feature/bedlevel/bedlevel.h"
51
   #include "../feature/bedlevel/bedlevel.h"
52
 #endif
52
 #endif
53
 
53
 
54
-#if NEED_UNHOMED_ERR && ENABLED(ULTRA_LCD)
54
+#if HAS_AXIS_UNHOMED_ERR && ENABLED(ULTRA_LCD)
55
   #include "../lcd/ultralcd.h"
55
   #include "../lcd/ultralcd.h"
56
 #endif
56
 #endif
57
 
57
 
820
   set_current_to_destination();
820
   set_current_to_destination();
821
 }
821
 }
822
 
822
 
823
-#if NEED_UNHOMED_ERR
823
+#if HAS_AXIS_UNHOMED_ERR
824
 
824
 
825
   bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
825
   bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
826
     #if ENABLED(HOME_AFTER_DEACTIVATE)
826
     #if ENABLED(HOME_AFTER_DEACTIVATE)
848
     return false;
848
     return false;
849
   }
849
   }
850
 
850
 
851
-#endif
851
+#endif // HAS_AXIS_UNHOMED_ERR
852
 
852
 
853
 /**
853
 /**
854
  * The homing feedrate may vary
854
  * The homing feedrate may vary

+ 17
- 3
Marlin/src/module/motion.h View File

167
 // Homing
167
 // Homing
168
 //
168
 //
169
 
169
 
170
-#define NEED_UNHOMED_ERR (HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION))
171
-
172
-#if NEED_UNHOMED_ERR
170
+#define HAS_AXIS_UNHOMED_ERR (                                                     \
171
+         ENABLED(Z_PROBE_ALLEN_KEY)                                                \
172
+      || ENABLED(Z_PROBE_SLED)                                                     \
173
+      || HAS_PROBING_PROCEDURE                                                     \
174
+      || HOTENDS > 1                                                               \
175
+      || ENABLED(NOZZLE_CLEAN_FEATURE)                                             \
176
+      || ENABLED(NOZZLE_PARK_FEATURE)                                              \
177
+      || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
178
+    ) || ENABLED(NO_MOTION_BEFORE_HOMING)
179
+
180
+#if HAS_AXIS_UNHOMED_ERR
173
   bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
181
   bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
174
 #endif
182
 #endif
175
 
183
 
184
+#if ENABLED(NO_MOTION_BEFORE_HOMING)
185
+  #define MOTION_CONDITIONS (IsRunning() && !axis_unhomed_error())
186
+#else
187
+  #define MOTION_CONDITIONS IsRunning()
188
+#endif
189
+
176
 void set_axis_is_at_home(const AxisEnum axis);
190
 void set_axis_is_at_home(const AxisEnum axis);
177
 
191
 
178
 void homeaxis(const AxisEnum axis);
192
 void homeaxis(const AxisEnum axis);

Loading…
Cancel
Save