Adjust axis homed / trusted methods (#20323)
This commit is contained in:
@ -34,19 +34,6 @@
|
||||
#include "scara.h"
|
||||
#endif
|
||||
|
||||
// Axis homed and known-position states
|
||||
extern uint8_t axis_homed, axis_known_position;
|
||||
constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
|
||||
FORCE_INLINE bool no_axes_homed() { return !axis_homed; }
|
||||
FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
|
||||
FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
|
||||
FORCE_INLINE void set_all_homed() { axis_homed = axis_known_position = xyz_bits; }
|
||||
FORCE_INLINE void set_all_unhomed() { axis_homed = axis_known_position = 0; }
|
||||
|
||||
FORCE_INLINE bool homing_needed() {
|
||||
return !TERN(HOME_AFTER_DEACTIVATE, all_axes_known, all_axes_homed)();
|
||||
}
|
||||
|
||||
// Error margin to work around float imprecision
|
||||
constexpr float fslop = 0.0001;
|
||||
|
||||
@ -269,23 +256,42 @@ void remember_feedrate_and_scaling();
|
||||
void remember_feedrate_scaling_off();
|
||||
void restore_feedrate_and_scaling();
|
||||
|
||||
void do_z_clearance(const float &zclear, const bool z_known=true, const bool raise_on_unknown=true, const bool lower_allowed=false);
|
||||
void do_z_clearance(const float &zclear, const bool z_trusted=true, const bool raise_on_untrusted=true, const bool lower_allowed=false);
|
||||
|
||||
/**
|
||||
* Homing and Trusted Axes
|
||||
*/
|
||||
constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
|
||||
extern uint8_t axis_homed, axis_trusted;
|
||||
|
||||
//
|
||||
// Homing
|
||||
//
|
||||
void homeaxis(const AxisEnum axis);
|
||||
void set_axis_is_at_home(const AxisEnum axis);
|
||||
void set_axis_never_homed(const AxisEnum axis);
|
||||
uint8_t axes_should_home(uint8_t axis_bits=0x07);
|
||||
bool homing_needed_error(uint8_t axis_bits=0x07);
|
||||
|
||||
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 xyz_bits == (axis_homed & xyz_bits); }
|
||||
FORCE_INLINE bool homing_needed() { return !all_axes_homed(); }
|
||||
FORCE_INLINE bool all_axes_trusted() { return xyz_bits == (axis_trusted & xyz_bits); }
|
||||
FORCE_INLINE void set_axis_homed(const AxisEnum axis) { SBI(axis_homed, axis); }
|
||||
FORCE_INLINE void set_axis_unhomed(const AxisEnum axis) { CBI(axis_homed, axis); }
|
||||
FORCE_INLINE void set_axis_trusted(const AxisEnum axis) { SBI(axis_trusted, axis); }
|
||||
FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
|
||||
FORCE_INLINE void set_all_homed() { axis_homed = axis_trusted = xyz_bits; }
|
||||
FORCE_INLINE void set_all_unhomed() { axis_homed = axis_trusted = 0; }
|
||||
|
||||
#if ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||
#define MOTION_CONDITIONS (IsRunning() && !homing_needed_error())
|
||||
#else
|
||||
#define MOTION_CONDITIONS IsRunning()
|
||||
#endif
|
||||
|
||||
#define BABYSTEP_ALLOWED() ((ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_trusted()) && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()))
|
||||
|
||||
/**
|
||||
* Workspace offsets
|
||||
*/
|
||||
|
Reference in New Issue
Block a user