dda_queue.c: eliminate another local variable.

This shaves off another 3 clock cycles without drawback. It
increases binary size by 8 bytes, but apparently only in places
where it doesn't matter.

Performance:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  19616 bytes      137%       64%       31%       16%
     Data:   2175 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 280 clock cycles.
  LED on time maximum: 545 clock cycles.
  LED on time average: 286.187 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 272 clock cycles.
  LED on time maximum: 576 clock cycles.
  LED on time average: 307.431 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 272 clock cycles.
  LED on time maximum: 535 clock cycles.
  LED on time average: 297.724 clock cycles.
This commit is contained in:
Markus Hitter 2016-11-22 00:16:21 +01:00
parent 9fe3855c3e
commit 721649e8ef
1 changed files with 5 additions and 6 deletions

View File

@ -153,19 +153,18 @@ void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) {
/// timer interrupt is disabled).
void next_move() {
while ((queue_empty() == 0) && (movebuffer[mb_tail].live == 0)) {
// next item
mb_tail = MB_NEXT(mb_tail);
DDA* current_movebuffer = &movebuffer[mb_tail];
// Tail must be set before calling timer_set(), as timer_set() reenables
// the timer interrupt, potentially exposing mb_tail to the timer
// interrupt routine.
if (current_movebuffer->waitfor_temp) {
mb_tail = MB_NEXT(mb_tail);
if (movebuffer[mb_tail].waitfor_temp) {
serial_writestr_P(PSTR("Waiting for target temp\n"));
current_movebuffer->live = 1;
movebuffer[mb_tail].live = 1;
timer_set(HEATER_WAIT_TIMEOUT, 0);
}
else {
dda_start(current_movebuffer);
dda_start(&movebuffer[mb_tail]);
}
}
}