dda.c: split move_step and move_step_no

12 bytes less
This commit is contained in:
Nico Tonnhofer 2017-04-10 22:04:53 +02:00
parent 3592622414
commit eacb5bbbed
1 changed files with 6 additions and 4 deletions

10
dda.c
View File

@ -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;
}