️ Home Z (and maybe XY) at the start of G35 (#22060)

This commit is contained in:
qwewer0 2021-06-14 23:52:42 +02:00 committed by Scott Lahteine
parent cdd9507493
commit dec083dcc1
6 changed files with 34 additions and 28 deletions

View File

@ -91,8 +91,8 @@ void GcodeSuite::G35() {
// Disable duplication mode on homing
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
// Home all before this procedure
home_all_axes();
// Home only Z axis when X and Y is trusted, otherwise all axes, if needed before this procedure
if (!all_axes_trusted()) process_subcommands_now_P(PSTR("G28Z"));
bool err_break = false;

View File

@ -39,7 +39,7 @@
void GcodeSuite::G34() {
// Home before the alignment procedure
if (!all_axes_trusted()) home_all_axes();
home_if_needed();
TERN_(HAS_LEVELING, TEMPORARY_BED_LEVELING_STATE(false));

View File

@ -167,7 +167,7 @@ void GcodeSuite::G34() {
));
// Home before the alignment procedure
if (!all_axes_trusted()) home_all_axes();
home_if_needed();
// Move the Z coordinate realm towards the positive - dirty trick
current_position.z += z_probe * 0.5f;

View File

@ -99,7 +99,7 @@ void GcodeSuite::M600() {
#if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
// If needed, home before parking for filament change
if (!all_axes_trusted()) home_all_axes(true);
home_if_needed(true);
#endif
#if HAS_MULTI_EXTRUDER

View File

@ -294,6 +294,10 @@ void report_current_position_projected() {
#endif
void home_if_needed(const bool keeplev/*=false*/) {
if (!all_axes_trusted()) gcode.home_all_axes(keeplev);
}
/**
* Run out the planner buffer and re-sync the current
* position from the last-updated stepper positions.

View File

@ -392,33 +392,35 @@ void set_axis_is_at_home(const AxisEnum axis);
void set_axis_never_homed(const AxisEnum axis);
linear_axis_bits_t axes_should_home(linear_axis_bits_t axis_bits=linear_bits);
bool homing_needed_error(linear_axis_bits_t axis_bits=linear_bits);
FORCE_INLINE void set_axis_unhomed(const AxisEnum axis) { CBI(axis_homed, axis); }
FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
FORCE_INLINE void set_all_unhomed() { axis_homed = axis_trusted = 0; }
FORCE_INLINE void set_axis_homed(const AxisEnum axis) { SBI(axis_homed, axis); }
FORCE_INLINE void set_axis_trusted(const AxisEnum axis) { SBI(axis_trusted, axis); }
FORCE_INLINE void set_all_homed() { axis_homed = axis_trusted = linear_bits; }
inline void set_axis_unhomed(const AxisEnum axis) { CBI(axis_homed, axis); }
inline void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
inline void set_all_unhomed() { axis_homed = axis_trusted = 0; }
inline void set_axis_homed(const AxisEnum axis) { SBI(axis_homed, axis); }
inline void set_axis_trusted(const AxisEnum axis) { SBI(axis_trusted, axis); }
inline void set_all_homed() { axis_homed = axis_trusted = linear_bits; }
#else
constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits; // Zero-endstop machines are always homed and trusted
FORCE_INLINE void homeaxis(const AxisEnum axis) {}
FORCE_INLINE void set_axis_never_homed(const AxisEnum) {}
FORCE_INLINE linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return false; }
FORCE_INLINE bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; }
FORCE_INLINE void set_axis_unhomed(const AxisEnum axis) {}
FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) {}
FORCE_INLINE void set_all_unhomed() {}
FORCE_INLINE void set_axis_homed(const AxisEnum axis) {}
FORCE_INLINE void set_axis_trusted(const AxisEnum axis) {}
FORCE_INLINE void set_all_homed() {}
inline void homeaxis(const AxisEnum axis) {}
inline void set_axis_never_homed(const AxisEnum) {}
inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return false; }
inline bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; }
inline void set_axis_unhomed(const AxisEnum axis) {}
inline void set_axis_untrusted(const AxisEnum axis) {}
inline void set_all_unhomed() {}
inline void set_axis_homed(const AxisEnum axis) {}
inline void set_axis_trusted(const AxisEnum axis) {}
inline void set_all_homed() {}
#endif
FORCE_INLINE bool axis_was_homed(const AxisEnum axis) { return TEST(axis_homed, axis); }
FORCE_INLINE bool axis_is_trusted(const AxisEnum axis) { return TEST(axis_trusted, axis); }
FORCE_INLINE bool axis_should_home(const AxisEnum axis) { return (axes_should_home() & _BV(axis)) != 0; }
FORCE_INLINE bool no_axes_homed() { return !axis_homed; }
FORCE_INLINE bool all_axes_homed() { return linear_bits == (axis_homed & linear_bits); }
FORCE_INLINE bool homing_needed() { return !all_axes_homed(); }
FORCE_INLINE bool all_axes_trusted() { return linear_bits == (axis_trusted & linear_bits); }
inline bool axis_was_homed(const AxisEnum axis) { return TEST(axis_homed, axis); }
inline bool axis_is_trusted(const AxisEnum axis) { return TEST(axis_trusted, axis); }
inline bool axis_should_home(const AxisEnum axis) { return (axes_should_home() & _BV(axis)) != 0; }
inline bool no_axes_homed() { return !axis_homed; }
inline bool all_axes_homed() { return linear_bits == (axis_homed & linear_bits); }
inline bool homing_needed() { return !all_axes_homed(); }
inline bool all_axes_trusted() { return linear_bits == (axis_trusted & linear_bits); }
void home_if_needed(const bool keeplev=false);
#if ENABLED(NO_MOTION_BEFORE_HOMING)
#define MOTION_CONDITIONS (IsRunning() && !homing_needed_error())