dda.c: simply resort the values and save up to 8 clocks
ATmega sizes '168 '328(P) '644(P) '1280 Program: 18266 bytes 128% 60% 29% 15% Data: 1936 bytes 190% 95% 48% 24% EEPROM: 32 bytes 4% 2% 2% 1% short-moves.gcode statistics: LED on occurences: 888. LED on time minimum: 243 clock cycles. LED on time maximum: 555 clock cycles. LED on time average: 250.375 clock cycles. smooth-curves.gcode statistics: LED on occurences: 22589. LED on time minimum: 243 clock cycles. LED on time maximum: 572 clock cycles. LED on time average: 292.139 clock cycles. triangle-odd.gcode statistics: LED on occurences: 1636. LED on time minimum: 243 clock cycles. LED on time maximum: 555 clock cycles. LED on time average: 275.699 clock cycles.
This commit is contained in:
parent
b36aa4168a
commit
22489c69cb
8
dda.c
8
dda.c
|
|
@ -538,33 +538,33 @@ void dda_step(DDA *dda) {
|
||||||
if (move_state.steps[X]) {
|
if (move_state.steps[X]) {
|
||||||
move_state.counter[X] -= dda->delta[X];
|
move_state.counter[X] -= dda->delta[X];
|
||||||
if (move_state.counter[X] < 0) {
|
if (move_state.counter[X] < 0) {
|
||||||
|
move_state.counter[X] += dda->total_steps;
|
||||||
x_step();
|
x_step();
|
||||||
move_state.steps[X]--;
|
move_state.steps[X]--;
|
||||||
move_state.counter[X] += dda->total_steps;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (move_state.steps[Y]) {
|
if (move_state.steps[Y]) {
|
||||||
move_state.counter[Y] -= dda->delta[Y];
|
move_state.counter[Y] -= dda->delta[Y];
|
||||||
if (move_state.counter[Y] < 0) {
|
if (move_state.counter[Y] < 0) {
|
||||||
|
move_state.counter[Y] += dda->total_steps;
|
||||||
y_step();
|
y_step();
|
||||||
move_state.steps[Y]--;
|
move_state.steps[Y]--;
|
||||||
move_state.counter[Y] += dda->total_steps;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (move_state.steps[Z]) {
|
if (move_state.steps[Z]) {
|
||||||
move_state.counter[Z] -= dda->delta[Z];
|
move_state.counter[Z] -= dda->delta[Z];
|
||||||
if (move_state.counter[Z] < 0) {
|
if (move_state.counter[Z] < 0) {
|
||||||
|
move_state.counter[Z] += dda->total_steps;
|
||||||
z_step();
|
z_step();
|
||||||
move_state.steps[Z]--;
|
move_state.steps[Z]--;
|
||||||
move_state.counter[Z] += dda->total_steps;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (move_state.steps[E]) {
|
if (move_state.steps[E]) {
|
||||||
move_state.counter[E] -= dda->delta[E];
|
move_state.counter[E] -= dda->delta[E];
|
||||||
if (move_state.counter[E] < 0) {
|
if (move_state.counter[E] < 0) {
|
||||||
|
move_state.counter[E] += dda->total_steps;
|
||||||
e_step();
|
e_step();
|
||||||
move_state.steps[E]--;
|
move_state.steps[E]--;
|
||||||
move_state.counter[E] += dda->total_steps;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
move_state.step_no++;
|
move_state.step_no++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue