always set timer after step as timer works differently now

This commit is contained in:
Michael Moon 2010-11-07 17:12:13 +11:00
parent 278a41ce79
commit be92a09db2
1 changed files with 5 additions and 7 deletions

8
dda.c
View File

@ -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,7 +523,6 @@ 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++;
@ -535,8 +532,8 @@ void dda_step(DDA *dda) {
// 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,6 +543,7 @@ 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.