Add CorePQ support for BABYSTEPPING (#10155)

This commit is contained in:
Scott Lahteine 2018-03-19 02:51:40 -05:00 committed by GitHub
parent 72281c4ff9
commit eaefc1e410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1304,16 +1304,16 @@ void Stepper::report_positions() {
#endif
#endif
#define BABYSTEP_AXIS(AXIS, INVERT) { \
const uint8_t old_dir = _READ_DIR(AXIS); \
_ENABLE(AXIS); \
_SAVE_START; \
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
_PULSE_WAIT; \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
_PULSE_WAIT; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
_APPLY_DIR(AXIS, old_dir); \
#define BABYSTEP_AXIS(AXIS, INVERT, DIR) { \
const uint8_t old_dir = _READ_DIR(AXIS); \
_ENABLE(AXIS); \
_SAVE_START; \
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^DIR^INVERT); \
_PULSE_WAIT; \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
_PULSE_WAIT; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
_APPLY_DIR(AXIS, old_dir); \
}
// MUST ONLY BE CALLED BY AN ISR,
@ -1326,20 +1326,43 @@ void Stepper::report_positions() {
#if ENABLED(BABYSTEP_XY)
case X_AXIS:
BABYSTEP_AXIS(X, false);
#if CORE_IS_XY
BABYSTEP_AXIS(X, false, direction);
BABYSTEP_AXIS(Y, false, direction);
#elif CORE_IS_XZ
BABYSTEP_AXIS(X, false, direction);
BABYSTEP_AXIS(Z, false, direction);
#else
BABYSTEP_AXIS(X, false, direction);
#endif
break;
case Y_AXIS:
BABYSTEP_AXIS(Y, false);
#if CORE_IS_XY
BABYSTEP_AXIS(X, false, direction);
BABYSTEP_AXIS(Y, false, direction^(CORESIGN(1)<0));
#elif CORE_IS_YZ
BABYSTEP_AXIS(Y, false, direction);
BABYSTEP_AXIS(Z, false, direction^(CORESIGN(1)<0));
#else
BABYSTEP_AXIS(Y, false, direction);
#endif
break;
#endif
case Z_AXIS: {
#if DISABLED(DELTA)
#if CORE_IS_XZ
BABYSTEP_AXIS(X, BABYSTEP_INVERT_Z, direction);
BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction^(CORESIGN(1)<0));
BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z);
#elif CORE_IS_YZ
BABYSTEP_AXIS(Y, BABYSTEP_INVERT_Z, direction);
BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction^(CORESIGN(1)<0));
#elif DISABLED(DELTA)
BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction);
#else // DELTA