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

@@ -35,17 +35,17 @@
Babystep babystep;
volatile int16_t Babystep::steps[BS_TODO_AXIS(Z_AXIS) + 1];
volatile int16_t Babystep::steps[BS_AXIS_IND(Z_AXIS) + 1];
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
#endif
int16_t Babystep::accum;
void Babystep::step_axis(const AxisEnum axis) {
const int16_t curTodo = steps[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
const int16_t curTodo = steps[BS_AXIS_IND(axis)]; // get rid of volatile for performance
if (curTodo) {
stepper.do_babystep((AxisEnum)axis, curTodo > 0);
if (curTodo > 0) steps[BS_TODO_AXIS(axis)]--; else steps[BS_TODO_AXIS(axis)]++;
if (curTodo > 0) steps[BS_AXIS_IND(axis)]--; else steps[BS_AXIS_IND(axis)]++;
}
}
@@ -112,7 +112,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#else
BSA_ENABLE(Z_AXIS);
#endif
steps[BS_TODO_AXIS(axis)] += distance;
steps[BS_AXIS_IND(axis)] += distance;
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();