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
//#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, ...
// 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_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
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;
}
#endif
#endif // HAS_AXIS_UNHOMED_ERR
#if ENABLED(Z_PROBE_SLED)
@ -2053,7 +2053,7 @@ static void clean_up_after_endstop_or_probe_move() {
#endif
}
#endif
#endif // Z_PROBE_ALLEN_KEY
#if ENABLED(PROBING_FANS_OFF)
@ -3383,6 +3383,10 @@ inline void gcode_G0_G1(
bool fast_move=false
#endif
) {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) {
gcode_get_destination(); // For X Y Z E F
@ -3438,6 +3442,10 @@ inline void gcode_G0_G1(
#if ENABLED(ARC_SUPPORT)
inline void gcode_G2_G3(bool clockwise) {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) {
#if ENABLED(SF_ARC_FIX)
@ -3535,6 +3543,10 @@ inline void gcode_G4() {
* G5: Cubic B-spline
*/
inline void gcode_G5() {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) {
#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)
*/
inline void gcode_G42() {
#if ENABLED(NO_MOTION_BEFORE_HOMING)
if (axis_unhomed_error()) return;
#endif
if (IsRunning()) {
const bool hasI = parser.seenval('I');
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])
#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
#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
#endif

Loading…
Cancel
Save