|
@ -407,38 +407,41 @@ void restore_feedrate_and_scaling(); |
|
|
/**
|
|
|
/**
|
|
|
* Homing and Trusted Axes |
|
|
* Homing and Trusted Axes |
|
|
*/ |
|
|
*/ |
|
|
typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type linear_axis_bits_t; |
|
|
typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type main_axes_bits_t; |
|
|
constexpr linear_axis_bits_t linear_bits = _BV(NUM_AXES) - 1; |
|
|
constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1; |
|
|
|
|
|
|
|
|
|
|
|
typedef IF<(NUM_AXES + EXTRUDERS > 8), uint16_t, uint8_t>::type e_axis_bits_t; |
|
|
|
|
|
constexpr e_axis_bits_t e_axis_mask = (_BV(EXTRUDERS) - 1) << NUM_AXES; |
|
|
|
|
|
|
|
|
void set_axis_is_at_home(const AxisEnum axis); |
|
|
void set_axis_is_at_home(const AxisEnum axis); |
|
|
|
|
|
|
|
|
#if HAS_ENDSTOPS |
|
|
#if HAS_ENDSTOPS |
|
|
/**
|
|
|
/**
|
|
|
* axis_homed |
|
|
* axes_homed |
|
|
* Flags that each linear axis was homed. |
|
|
* Flags that each linear axis was homed. |
|
|
* XYZ on cartesian, ABC on delta, ABZ on SCARA. |
|
|
* XYZ on cartesian, ABC on delta, ABZ on SCARA. |
|
|
* |
|
|
* |
|
|
* axis_trusted |
|
|
* axes_trusted |
|
|
* Flags that the position is trusted in each linear axis. Set when homed. |
|
|
* Flags that the position is trusted in each linear axis. Set when homed. |
|
|
* Cleared whenever a stepper powers off, potentially losing its position. |
|
|
* Cleared whenever a stepper powers off, potentially losing its position. |
|
|
*/ |
|
|
*/ |
|
|
extern linear_axis_bits_t axis_homed, axis_trusted; |
|
|
extern main_axes_bits_t axes_homed, axes_trusted; |
|
|
void homeaxis(const AxisEnum axis); |
|
|
void homeaxis(const AxisEnum axis); |
|
|
void set_axis_never_homed(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); |
|
|
main_axes_bits_t axes_should_home(main_axes_bits_t axes_mask=main_axes_mask); |
|
|
bool homing_needed_error(linear_axis_bits_t axis_bits=linear_bits); |
|
|
bool homing_needed_error(main_axes_bits_t axes_mask=main_axes_mask); |
|
|
inline void set_axis_unhomed(const AxisEnum axis) { CBI(axis_homed, axis); } |
|
|
inline void set_axis_unhomed(const AxisEnum axis) { CBI(axes_homed, axis); } |
|
|
inline void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); } |
|
|
inline void set_axis_untrusted(const AxisEnum axis) { CBI(axes_trusted, axis); } |
|
|
inline void set_all_unhomed() { axis_homed = axis_trusted = 0; } |
|
|
inline void set_all_unhomed() { axes_homed = axes_trusted = 0; } |
|
|
inline void set_axis_homed(const AxisEnum axis) { SBI(axis_homed, axis); } |
|
|
inline void set_axis_homed(const AxisEnum axis) { SBI(axes_homed, axis); } |
|
|
inline void set_axis_trusted(const AxisEnum axis) { SBI(axis_trusted, axis); } |
|
|
inline void set_axis_trusted(const AxisEnum axis) { SBI(axes_trusted, axis); } |
|
|
inline void set_all_homed() { axis_homed = axis_trusted = linear_bits; } |
|
|
inline void set_all_homed() { axes_homed = axes_trusted = main_axes_mask; } |
|
|
#else |
|
|
#else |
|
|
constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits; // Zero-endstop machines are always homed and trusted
|
|
|
constexpr main_axes_bits_t axes_homed = main_axes_mask, axes_trusted = main_axes_mask; // Zero-endstop machines are always homed and trusted
|
|
|
inline void homeaxis(const AxisEnum axis) {} |
|
|
inline void homeaxis(const AxisEnum axis) {} |
|
|
inline void set_axis_never_homed(const AxisEnum) {} |
|
|
inline void set_axis_never_homed(const AxisEnum) {} |
|
|
inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return 0; } |
|
|
inline main_axes_bits_t axes_should_home(main_axes_bits_t=main_axes_mask) { return 0; } |
|
|
inline bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; } |
|
|
inline bool homing_needed_error(main_axes_bits_t=main_axes_mask) { return false; } |
|
|
inline void set_axis_unhomed(const AxisEnum axis) {} |
|
|
inline void set_axis_unhomed(const AxisEnum axis) {} |
|
|
inline void set_axis_untrusted(const AxisEnum axis) {} |
|
|
inline void set_axis_untrusted(const AxisEnum axis) {} |
|
|
inline void set_all_unhomed() {} |
|
|
inline void set_all_unhomed() {} |
|
@ -447,13 +450,13 @@ void set_axis_is_at_home(const AxisEnum axis); |
|
|
inline void set_all_homed() {} |
|
|
inline void set_all_homed() {} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
inline bool axis_was_homed(const AxisEnum axis) { return TEST(axis_homed, axis); } |
|
|
inline bool axis_was_homed(const AxisEnum axis) { return TEST(axes_homed, axis); } |
|
|
inline bool axis_is_trusted(const AxisEnum axis) { return TEST(axis_trusted, axis); } |
|
|
inline bool axis_is_trusted(const AxisEnum axis) { return TEST(axes_trusted, axis); } |
|
|
inline bool axis_should_home(const AxisEnum axis) { return (axes_should_home() & _BV(axis)) != 0; } |
|
|
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 no_axes_homed() { return !axes_homed; } |
|
|
inline bool all_axes_homed() { return linear_bits == (axis_homed & linear_bits); } |
|
|
inline bool all_axes_homed() { return main_axes_mask == (axes_homed & main_axes_mask); } |
|
|
inline bool homing_needed() { return !all_axes_homed(); } |
|
|
inline bool homing_needed() { return !all_axes_homed(); } |
|
|
inline bool all_axes_trusted() { return linear_bits == (axis_trusted & linear_bits); } |
|
|
inline bool all_axes_trusted() { return main_axes_mask == (axes_trusted & main_axes_mask); } |
|
|
|
|
|
|
|
|
void home_if_needed(const bool keeplev=false); |
|
|
void home_if_needed(const bool keeplev=false); |
|
|
|
|
|
|
|
|