From eacb5bbbedccaa2d19bd3a5252048772e05942ea Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Mon, 10 Apr 2017 22:04:53 +0200 Subject: [PATCH] dda.c: split move_step and move_step_no 12 bytes less --- dda.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dda.c b/dda.c index e026c1e..48dbd8e 100644 --- a/dda.c +++ b/dda.c @@ -740,7 +740,7 @@ void dda_clock() { static DDA *last_dda = NULL; uint8_t endstop_trigger = 0; #ifdef ACCELERATION_RAMPING - uint32_t move_step_no, move_c; + uint32_t move_step_no, move_step, move_c; int32_t move_n; uint8_t recalc_speed; uint8_t current_id ; @@ -854,11 +854,13 @@ void dda_clock() { // and http://www.atmel.com/images/doc8017.pdf (Atmel app note AVR446) ATOMIC_START current_id = dda->id; - move_step_no = dda->total_steps - move_state.steps[dda->fast_axis]; + move_step = move_state.steps[dda->fast_axis]; // All other variables are read-only or unused in dda_step(), // so no need for atomic operations. ATOMIC_END + move_step_no = dda->total_steps - move_step; + recalc_speed = 0; if (move_step_no < dda->rampup_steps) { #ifdef LOOKAHEAD @@ -870,9 +872,9 @@ void dda_clock() { } else if (move_step_no >= dda->rampdown_steps) { #ifdef LOOKAHEAD - move_n = dda->total_steps - move_step_no + dda->end_steps; + move_n = move_step + dda->end_steps; #else - move_n = dda->total_steps - move_step_no; + move_n = move_step; #endif recalc_speed = 1; }