Fix Babystepping loop (again)

This commit is contained in:
Scott Lahteine
2020-02-24 05:29:13 -06:00
parent 8ba5ef8cae
commit 5e197df89a
8 changed files with 48 additions and 36 deletions

View File

@@ -32,9 +32,11 @@
#endif
#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
#define BS_TODO_AXIS(A) A
#define BS_AXIS_IND(A) A
#define BS_AXIS(I) AxisEnum(I)
#else
#define BS_TODO_AXIS(A) 0
#define BS_AXIS_IND(A) 0
#define BS_AXIS(I) Z_AXIS
#endif
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
@@ -47,7 +49,7 @@
class Babystep {
public:
static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1];
static volatile int16_t steps[BS_AXIS_IND(Z_AXIS) + 1];
static int16_t accum; // Total babysteps in current edit
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
@@ -65,7 +67,7 @@ public:
static void add_mm(const AxisEnum axis, const float &mm);
static inline bool has_steps() {
return steps[BS_TODO_AXIS(X_AXIS)] || steps[BS_TODO_AXIS(Y_AXIS)] || steps[BS_TODO_AXIS(Z_AXIS)];
return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)];
}
//
@@ -73,7 +75,7 @@ public:
// apply accumulated babysteps to the axes.
//
static inline void task() {
LOOP_LE_N(axis, BS_TODO_AXIS(Z_AXIS)) step_axis((AxisEnum)axis);
LOOP_LE_N(i, BS_AXIS_IND(Z_AXIS)) step_axis(BS_AXIS(i));
}
private: