dda.c: deal with endstop hits while still accelerating.
Also, move_state.step_no must be read atomically.
This commit is contained in:
parent
5ee9a0bd3c
commit
fa1a7d4ef7
10
dda.c
10
dda.c
|
|
@ -765,11 +765,15 @@ void dda_clock() {
|
||||||
// but start deceleration here.
|
// but start deceleration here.
|
||||||
ATOMIC_START
|
ATOMIC_START
|
||||||
move_state.endstop_stop = 1;
|
move_state.endstop_stop = 1;
|
||||||
// A "-=" would cause an overflow.
|
if (move_state.step_no < dda->rampup_steps) // still accelerating
|
||||||
dda->total_steps = dda->total_steps - dda->rampdown_steps + move_state.step_no;
|
dda->total_steps = move_state.step_no * 2;
|
||||||
|
else
|
||||||
|
// A "-=" would overflow earlier.
|
||||||
|
dda->total_steps = dda->total_steps - dda->rampdown_steps +
|
||||||
|
move_state.step_no;
|
||||||
|
dda->rampdown_steps = move_state.step_no;
|
||||||
ATOMIC_END
|
ATOMIC_END
|
||||||
// Not atomic, because not used in dda_step().
|
// Not atomic, because not used in dda_step().
|
||||||
dda->rampdown_steps = move_state.step_no;
|
|
||||||
dda->rampup_steps = 0; // in case we're still accelerating
|
dda->rampup_steps = 0; // in case we're still accelerating
|
||||||
#else
|
#else
|
||||||
dda->live = 0;
|
dda->live = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue