Clear up HAS_WORKSPACE_OFFSET meaning
This commit is contained in:
parent
6e3caf23b6
commit
2c9586be0c
3 changed files with 20 additions and 26 deletions
|
@ -1527,11 +1527,11 @@
|
||||||
// Updated G92 behavior shifts the workspace
|
// Updated G92 behavior shifts the workspace
|
||||||
#define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
|
#define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
|
||||||
// The home offset also shifts the coordinate space
|
// The home offset also shifts the coordinate space
|
||||||
#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA))
|
#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && (IS_SCARA || IS_CARTESIAN))
|
||||||
// Either offset yields extra calculations on all moves
|
// Cumulative offset to workspace to save some calculation
|
||||||
#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT || HAS_HOME_OFFSET)
|
#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET)
|
||||||
// M206 doesn't apply to DELTA
|
// M206 sets the home offset for Cartesian machines
|
||||||
#define HAS_M206_COMMAND (HAS_HOME_OFFSET && DISABLED(DELTA))
|
#define HAS_M206_COMMAND (HAS_HOME_OFFSET && !IS_SCARA)
|
||||||
|
|
||||||
// LCD timeout to status screen default is 15s
|
// LCD timeout to status screen default is 15s
|
||||||
#ifndef LCD_TIMEOUT_TO_STATUS
|
#ifndef LCD_TIMEOUT_TO_STATUS
|
||||||
|
|
|
@ -138,20 +138,18 @@ float cartes[XYZ];
|
||||||
* The workspace can be offset by some commands, or
|
* The workspace can be offset by some commands, or
|
||||||
* these offsets may be omitted to save on computation.
|
* these offsets may be omitted to save on computation.
|
||||||
*/
|
*/
|
||||||
#if HAS_WORKSPACE_OFFSET
|
#if HAS_POSITION_SHIFT
|
||||||
#if HAS_POSITION_SHIFT
|
// The distance that XYZ has been offset by G92. Reset by G28.
|
||||||
// The distance that XYZ has been offset by G92. Reset by G28.
|
float position_shift[XYZ] = { 0 };
|
||||||
float position_shift[XYZ] = { 0 };
|
#endif
|
||||||
#endif
|
#if HAS_HOME_OFFSET
|
||||||
#if HAS_HOME_OFFSET
|
// This offset is added to the configured home position.
|
||||||
// This offset is added to the configured home position.
|
// Set by M206, M428, or menu item. Saved to EEPROM.
|
||||||
// Set by M206, M428, or menu item. Saved to EEPROM.
|
float home_offset[XYZ] = { 0 };
|
||||||
float home_offset[XYZ] = { 0 };
|
#endif
|
||||||
#endif
|
#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
||||||
#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
// The above two are combined to save on computes
|
||||||
// The above two are combined to save on computes
|
float workspace_offset[XYZ] = { 0 };
|
||||||
float workspace_offset[XYZ] = { 0 };
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OLDSCHOOL_ABL
|
#if OLDSCHOOL_ABL
|
||||||
|
@ -1518,7 +1516,7 @@ void homeaxis(const AxisEnum axis) {
|
||||||
* at the same positions relative to the machine.
|
* at the same positions relative to the machine.
|
||||||
*/
|
*/
|
||||||
void update_software_endstops(const AxisEnum axis) {
|
void update_software_endstops(const AxisEnum axis) {
|
||||||
#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
|
#if HAS_HOME_OFFSET
|
||||||
workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -211,14 +211,10 @@ void homeaxis(const AxisEnum axis);
|
||||||
void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
|
void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// Macros
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workspace offsets
|
* Workspace offsets
|
||||||
*/
|
*/
|
||||||
#if HAS_WORKSPACE_OFFSET
|
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
||||||
#if HAS_HOME_OFFSET
|
#if HAS_HOME_OFFSET
|
||||||
extern float home_offset[XYZ];
|
extern float home_offset[XYZ];
|
||||||
#endif
|
#endif
|
||||||
|
@ -230,7 +226,7 @@ void homeaxis(const AxisEnum axis);
|
||||||
#define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS]
|
#define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS]
|
||||||
#elif HAS_HOME_OFFSET
|
#elif HAS_HOME_OFFSET
|
||||||
#define WORKSPACE_OFFSET(AXIS) home_offset[AXIS]
|
#define WORKSPACE_OFFSET(AXIS) home_offset[AXIS]
|
||||||
#elif HAS_POSITION_SHIFT
|
#else
|
||||||
#define WORKSPACE_OFFSET(AXIS) position_shift[AXIS]
|
#define WORKSPACE_OFFSET(AXIS) position_shift[AXIS]
|
||||||
#endif
|
#endif
|
||||||
#define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
|
#define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
|
||||||
|
|
Reference in a new issue