dda.c: put code for ACCELERATION_TEMPORAL in dda_step() together.

Performance for ACCELERATION_RAMPING unchanged:

$ cd testcases
$ ./run-in-simulavr.sh short-moves.gcode smooth-curves.gcode triangle-odd.gcode
[...]
    SIZES             ATmega...  '168    '328(P)    '644(P)    '1280
    FLASH  : 20518 bytes         144%        67%        33%      16%
    RAM    :  2188 bytes         214%       107%        54%      27%
    EEPROM :    32 bytes           4%         2%         2%       1%

short-moves.gcode statistics:
LED on occurences: 838.
LED on time minimum: 302 clock cycles.
LED on time maximum: 713 clock cycles.
LED on time average: 308.72 clock cycles.

smooth-curves.gcode statistics:
LED on occurences: 8585.
LED on time minimum: 307 clock cycles.
LED on time maximum: 710 clock cycles.
LED on time average: 358.051 clock cycles.

triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 302 clock cycles.
LED on time maximum: 708 clock cycles.
LED on time average: 330.322 clock cycles.
This commit is contained in:
Markus Hitter 2015-03-01 14:49:56 +01:00
parent 8b88334b06
commit 7dda91ab56
1 changed files with 26 additions and 38 deletions

64
dda.c
View File

@ -565,16 +565,6 @@ void dda_step(DDA *dda) {
move_state.counter[X] += dda->total_steps;
}
}
#else // ACCELERATION_TEMPORAL
if (dda->axis_to_step == X) {
x_step();
move_state.steps[X]--;
move_state.time[X] += dda->step_interval[X];
move_state.last_time = move_state.time[X];
}
#endif
#if ! defined ACCELERATION_TEMPORAL
if (move_state.steps[Y]) {
move_state.counter[Y] -= dda->delta[Y];
if (move_state.counter[Y] < 0) {
@ -583,16 +573,6 @@ void dda_step(DDA *dda) {
move_state.counter[Y] += dda->total_steps;
}
}
#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.last_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) {
@ -601,16 +581,6 @@ void dda_step(DDA *dda) {
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.last_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) {
@ -619,13 +589,6 @@ void dda_step(DDA *dda) {
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.last_time = move_state.time[E];
}
#endif
#ifdef ACCELERATION_REPRAP
@ -680,10 +643,35 @@ void dda_step(DDA *dda) {
timer shall do the step as soon as possible and compensate for the delay
later. In turn we promise here to send a maximum of four such
short-delays consecutively and to give sufficient time on average.
*/
*/
uint32_t c_candidate;
uint8_t i;
if (dda->axis_to_step == X) {
x_step();
move_state.steps[X]--;
move_state.time[X] += dda->step_interval[X];
move_state.last_time = move_state.time[X];
}
if (dda->axis_to_step == Y) {
y_step();
move_state.steps[Y]--;
move_state.time[Y] += dda->step_interval[Y];
move_state.last_time = move_state.time[Y];
}
if (dda->axis_to_step == Z) {
z_step();
move_state.steps[Z]--;
move_state.time[Z] += dda->step_interval[Z];
move_state.last_time = move_state.time[Z];
}
if (dda->axis_to_step == E) {
e_step();
move_state.steps[E]--;
move_state.time[E] += dda->step_interval[E];
move_state.last_time = move_state.time[E];
}
dda->c = 0xFFFFFFFF;
for (i = X; i < AXIS_COUNT; i++) {
if (move_state.steps[i]) {