From 1e052a77a282667df184a95bbd1f8d0eead75155 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Thu, 26 Jan 2017 23:27:23 +0100 Subject: [PATCH] DDA: The test of total_steps against step_no was a good idea. So let's bring this part back. We save 35 clock cycles at 'LED on time maximum' ATmega sizes '168 '328(P) '644(P) '1280 Program: 18038 bytes 126% 59% 29% 14% 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: 217 clock cycles. LED on time maximum: 520 clock cycles. LED on time average: 249.626 clock cycles. smooth-curves.gcode statistics: LED on occurences: 22589. LED on time minimum: 217 clock cycles. LED on time maximum: 537 clock cycles. LED on time average: 284.747 clock cycles. triangle-odd.gcode statistics: LED on occurences: 1636. LED on time minimum: 217 clock cycles. LED on time maximum: 520 clock cycles. LED on time average: 270.933 clock cycles. --- dda.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dda.c b/dda.c index b7e8efb..854e7e0 100644 --- a/dda.c +++ b/dda.c @@ -676,12 +676,14 @@ void dda_step(DDA *dda) { // // TODO: with ACCELERATION_TEMPORAL this duplicates some code. See where // dda->live is zero'd, about 10 lines above. - if ((move_state.steps[X] == 0 && move_state.steps[Y] == 0 && + #if ! defined ACCELERATION_TEMPORAL + if (move_state.step_no >= dda->total_steps || + (move_state.endstop_stop && dda->n <= 0)) + #else + if (move_state.steps[X] == 0 && move_state.steps[Y] == 0 && move_state.steps[Z] == 0 && move_state.steps[E] == 0) - #ifdef ACCELERATION_RAMPING - || (move_state.endstop_stop && dda->n <= 0) #endif - ) { + { dda->live = 0; dda->done = 1; #ifdef LOOKAHEAD