DDA: Revert move axis calculations into loops, part 6a-c.

Sad but true, this experiment didn't work out. Performance loss
due to looping in dda_step() is still at least 16% with the best
algorithm found.
This commit is contained in:
Markus Hitter 2014-06-18 00:49:50 +02:00
parent 1fc4a26ccd
commit cc9c9ff7b4
1 changed files with 70 additions and 28 deletions

98
dda.c
View File

@ -482,36 +482,78 @@ void dda_start(DDA *dda) {
Finally we de-assert any asserted step pins. Finally we de-assert any asserted step pins.
*/ */
void dda_step(DDA *dda) { void dda_step(DDA *dda) {
enum axis_e i;
char to_step_flags = 0;
#if ! defined ACCELERATION_TEMPORAL #if ! defined ACCELERATION_TEMPORAL
for (i = X; i < AXIS_COUNT; i++) { if (move_state.steps[X]) {
if (move_state.steps[i]) { move_state.counter[X] -= dda->delta[X];
move_state.counter[i] -= dda->delta[i]; if (move_state.counter[X] < 0) {
if (move_state.counter[i] < 0) { x_step();
to_step_flags |= (0x01 << i); move_state.steps[X]--;
move_state.steps[i]--; move_state.counter[X] += dda->total_steps;
move_state.counter[i] += dda->total_steps; }
} }
} #else // ACCELERATION_TEMPORAL
} if (dda->axis_to_step == X) {
#else // ACCELERATION_TEMPORAL x_step();
i = dda->axis_to_step; move_state.steps[X]--;
to_step_flags |= (0x01 << i); move_state.time[X] += dda->step_interval[X];
move_state.steps[i]--; move_state.all_time = move_state.time[X];
move_state.time[i] += dda->step_interval[i]; }
move_state.all_time = move_state.time[i]; #endif
#endif
if (to_step_flags & (0x01 << X)) #if ! defined ACCELERATION_TEMPORAL
x_step(); if (move_state.steps[Y]) {
if (to_step_flags & (0x01 << Y)) move_state.counter[Y] -= dda->delta[Y];
y_step(); if (move_state.counter[Y] < 0) {
if (to_step_flags & (0x01 << Z)) y_step();
z_step(); move_state.steps[Y]--;
if (to_step_flags & (0x01 << E)) move_state.counter[Y] += dda->total_steps;
e_step(); }
}
#else // ACCELERATION_TEMPORAL
if (dda->axis_to_step == Y) {
y_step();
move_state.steps[Y]--;
move_state.time[Y] += dda->step_interval[Y];
move_state.all_time = move_state.time[Y];
}
#endif
#if ! defined ACCELERATION_TEMPORAL
if (move_state.steps[Z]) {
move_state.counter[Z] -= dda->delta[Z];
if (move_state.counter[Z] < 0) {
z_step();
move_state.steps[Z]--;
move_state.counter[Z] += dda->total_steps;
}
}
#else // ACCELERATION_TEMPORAL
if (dda->axis_to_step == Z) {
z_step();
move_state.steps[Z]--;
move_state.time[Z] += dda->step_interval[Z];
move_state.all_time = move_state.time[Z];
}
#endif
#if ! defined ACCELERATION_TEMPORAL
if (move_state.steps[E]) {
move_state.counter[E] -= dda->delta[E];
if (move_state.counter[E] < 0) {
e_step();
move_state.steps[E]--;
move_state.counter[E] += dda->total_steps;
}
}
#else // ACCELERATION_TEMPORAL
if (dda->axis_to_step == E) {
e_step();
move_state.steps[E]--;
move_state.time[E] += dda->step_interval[E];
move_state.all_time = move_state.time[E];
}
#endif
#if STEP_INTERRUPT_INTERRUPTIBLE && ! defined ACCELERATION_RAMPING #if STEP_INTERRUPT_INTERRUPTIBLE && ! defined ACCELERATION_RAMPING
// Since we have sent steps to all the motors that will be stepping // Since we have sent steps to all the motors that will be stepping