Implementing [FR] #7548

Added new configuration to inhibit XYZ movements when home is not done
master
GMagician 7 years ago committed by Scott Lahteine
parent ac70048945
commit 33d28c24bf

@ -759,6 +759,8 @@
// @section homing // @section homing
//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed
//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... //#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
// Be sure you have this distance over your Z_MAX_POS in case. // Be sure you have this distance over your Z_MAX_POS in case.

@ -422,7 +422,15 @@ void do_blocking_move_to_x(const float &x, const float &fr_mm_s=0.0);
void do_blocking_move_to_z(const float &z, const float &fr_mm_s=0.0); void do_blocking_move_to_z(const float &z, const float &fr_mm_s=0.0);
void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0); void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0);
#define HAS_AXIS_UNHOMED_ERR (ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE))) #define HAS_AXIS_UNHOMED_ERR ( \
ENABLED(Z_PROBE_ALLEN_KEY) \
|| ENABLED(Z_PROBE_SLED) \
|| HAS_PROBING_PROCEDURE \
|| HOTENDS > 1 \
|| ENABLED(NOZZLE_CLEAN_FEATURE) \
|| ENABLED(NOZZLE_PARK_FEATURE) \
|| (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
) || ENABLED(NO_MOTION_BEFORE_HOMING)
#if HAS_AXIS_UNHOMED_ERR #if HAS_AXIS_UNHOMED_ERR
bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true); bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);

@ -1850,7 +1850,7 @@ static void clean_up_after_endstop_or_probe_move() {
return false; return false;
} }
#endif #endif // HAS_AXIS_UNHOMED_ERR
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
@ -2053,7 +2053,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif #endif
} }
#endif #endif // Z_PROBE_ALLEN_KEY
#if ENABLED(PROBING_FANS_OFF) #if ENABLED(PROBING_FANS_OFF)
@ -3383,6 +3383,10 @@ inline void gcode_G0_G1(
bool fast_move=false bool fast_move=false
#endif #endif
) { ) {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) { if (IsRunning()) {
gcode_get_destination(); // For X Y Z E F gcode_get_destination(); // For X Y Z E F
@ -3438,6 +3442,10 @@ inline void gcode_G0_G1(
#if ENABLED(ARC_SUPPORT) #if ENABLED(ARC_SUPPORT)
inline void gcode_G2_G3(bool clockwise) { inline void gcode_G2_G3(bool clockwise) {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) { if (IsRunning()) {
#if ENABLED(SF_ARC_FIX) #if ENABLED(SF_ARC_FIX)
@ -3535,6 +3543,10 @@ inline void gcode_G4() {
* G5: Cubic B-spline * G5: Cubic B-spline
*/ */
inline void gcode_G5() { inline void gcode_G5() {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) { if (IsRunning()) {
#if ENABLED(CNC_WORKSPACE_PLANES) #if ENABLED(CNC_WORKSPACE_PLANES)
@ -5862,6 +5874,10 @@ void home_all_axes() { gcode_G28(true); }
* G42: Move X & Y axes to mesh coordinates (I & J) * G42: Move X & Y axes to mesh coordinates (I & J)
*/ */
inline void gcode_G42() { inline void gcode_G42() {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) { if (IsRunning()) {
const bool hasI = parser.seenval('I'); const bool hasI = parser.seenval('I');
const int8_t ix = hasI ? parser.value_int() : 0; const int8_t ix = hasI ? parser.value_int() : 0;

@ -2929,19 +2929,19 @@ void kill_screen(const char* lcd_msg) {
* *
*/ */
#if IS_KINEMATIC #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
#define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#if ENABLED(DELTA)
#define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
void lcd_lower_z_to_clip_height() {
line_to_z(delta_clip_start_height);
lcd_synchronize();
}
#else
#define _MOVE_XY_ALLOWED true
#endif
#else #else
#define _MOVE_XYZ_ALLOWED true #define _MOVE_XYZ_ALLOWED true
#endif
#if ENABLED(DELTA)
#define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
void lcd_lower_z_to_clip_height() {
line_to_z(delta_clip_start_height);
lcd_synchronize();
}
#else
#define _MOVE_XY_ALLOWED true #define _MOVE_XY_ALLOWED true
#endif #endif

Loading…
Cancel
Save