always set timer after step as timer works differently now
This commit is contained in:
parent
278a41ce79
commit
be92a09db2
12
dda.c
12
dda.c
|
|
@ -491,11 +491,9 @@ void dda_step(DDA *dda) {
|
||||||
) {
|
) {
|
||||||
dda->c = (int32_t) dda->c - ((int32_t) (dda->c * 2) / dda->n);
|
dda->c = (int32_t) dda->c - ((int32_t) (dda->c * 2) / dda->n);
|
||||||
dda->n += 4;
|
dda->n += 4;
|
||||||
setTimer(dda->c >> 8);
|
|
||||||
}
|
}
|
||||||
else if (dda->c != dda->end_c) {
|
else if (dda->c != dda->end_c) {
|
||||||
dda->c = dda->end_c;
|
dda->c = dda->end_c;
|
||||||
setTimer(dda->c >> 8);
|
|
||||||
}
|
}
|
||||||
// else we are already at target speed
|
// else we are already at target speed
|
||||||
}
|
}
|
||||||
|
|
@ -525,18 +523,17 @@ void dda_step(DDA *dda) {
|
||||||
dda->ramp_state = RAMP_MAX;
|
dda->ramp_state = RAMP_MAX;
|
||||||
dda->ramp_steps = dda->total_steps - dda->step_no;
|
dda->ramp_steps = dda->total_steps - dda->step_no;
|
||||||
}
|
}
|
||||||
setTimer(dda->c >> 8);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dda->step_no++;
|
dda->step_no++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (did_step) {
|
if (did_step) {
|
||||||
// we stepped, reset timeout
|
// we stepped, reset timeout
|
||||||
steptimeout = 0;
|
steptimeout = 0;
|
||||||
|
|
||||||
// if we could do anything at all, we're still running
|
// if we could do anything at all, we're still running
|
||||||
// otherwise, must have finished
|
// otherwise, must have finished
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dda->live = 0;
|
dda->live = 0;
|
||||||
|
|
@ -546,7 +543,8 @@ void dda_step(DDA *dda) {
|
||||||
// in theory, we *could* update F every step, but that would require a divide in interrupt context which should be avoided if at all possible
|
// in theory, we *could* update F every step, but that would require a divide in interrupt context which should be avoided if at all possible
|
||||||
current_position.F = dda->endpoint.F;
|
current_position.F = dda->endpoint.F;
|
||||||
}
|
}
|
||||||
|
setTimer(dda->c >> 8);
|
||||||
|
|
||||||
// turn off step outputs, hopefully they've been on long enough by now to register with the drivers
|
// turn off step outputs, hopefully they've been on long enough by now to register with the drivers
|
||||||
// if not, too bad. or insert a (very!) small delay here, or fire up a spare timer or something.
|
// if not, too bad. or insert a (very!) small delay here, or fire up a spare timer or something.
|
||||||
// we also hope that we don't step before the drivers register the low- limit maximum speed if you think this is a problem.
|
// we also hope that we don't step before the drivers register the low- limit maximum speed if you think this is a problem.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue