dda_lookahead.c: reduce size of ATOMIC section.
We calculate a safe join speed in dda_join_moves using data from
two source DDA movements. We ensure the DDA values we use are sane
by atomically copying them to local variables before beginning our
calculation. But later we discard all our results if the DDA went
live in the meantime, as evidenced by changes in `DDA->live` or
`DDA->id`.
Since we will not use the results of our calculations if either of
these change, we can safely reference all the other DDA values
non-atomically. Change the ATOMIC section to protect only the
`DDA->id` values at the start.
Added by Traumflug: this costs a negligible 4 bytes binary size:
ATmega sizes '168 '328(P) '644(P) '1280
Program: 18082 bytes 127% 59% 29% 15%
Data: 2176 bytes 213% 107% 54% 27%
EEPROM: 32 bytes 4% 2% 2% 1%
This commit is contained in:
parent
c33791333c
commit
f0fa5f9f3e
|
|
@ -190,17 +190,18 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
|||
|
||||
// Make sure we have 2 moves and the previous move is not already active
|
||||
if (prev->live == 0) {
|
||||
// Perform an atomic copy to preserve volatile parameters during the calculations
|
||||
// Copy DDA ids to verify later that nothing changed during calculations
|
||||
ATOMIC_START
|
||||
prev_id = prev->id;
|
||||
this_id = current->id;
|
||||
ATOMIC_END
|
||||
|
||||
prev_F = prev->endpoint.F;
|
||||
prev_F_start_in_steps = prev->start_steps;
|
||||
prev_total_steps = prev->total_steps;
|
||||
crossF = current->crossF;
|
||||
this_id = current->id;
|
||||
this_total_steps = current->total_steps;
|
||||
this_fast_axis = current->fast_axis;
|
||||
ATOMIC_END
|
||||
|
||||
// Here we have to distinguish between feedrate along the movement
|
||||
// direction and feedrate of the fast axis. They can differ by a factor
|
||||
|
|
|
|||
Loading…
Reference in New Issue