dda_lookahead.c: use the new ATOMIC macros here as well.
This commit is contained in:
parent
36c07d3423
commit
da085670f4
|
|
@ -12,7 +12,6 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <util/atomic.h>
|
|
||||||
|
|
||||||
#include "dda_maths.h"
|
#include "dda_maths.h"
|
||||||
#include "dda.h"
|
#include "dda.h"
|
||||||
|
|
@ -25,6 +24,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "sersendf.h"
|
#include "sersendf.h"
|
||||||
#include "pinio.h"
|
#include "pinio.h"
|
||||||
|
#include "memory_barrier.h"
|
||||||
|
|
||||||
extern uint8_t use_lookahead;
|
extern uint8_t use_lookahead;
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
||||||
// Make sure we have 2 moves and the previous move is not already active
|
// Make sure we have 2 moves and the previous move is not already active
|
||||||
if(prev!=NULL && prev->live==0) {
|
if(prev!=NULL && prev->live==0) {
|
||||||
// Perform an atomic copy to preserve volatile parameters during the calculations
|
// Perform an atomic copy to preserve volatile parameters during the calculations
|
||||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
ATOMIC_START
|
||||||
prev_id = prev->id;
|
prev_id = prev->id;
|
||||||
prev_F = prev->endpoint.F;
|
prev_F = prev->endpoint.F;
|
||||||
prev_F_start = prev->F_start;
|
prev_F_start = prev->F_start;
|
||||||
|
|
@ -220,7 +220,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
||||||
prev_rampup = prev->rampup_steps;
|
prev_rampup = prev->rampup_steps;
|
||||||
prev_rampdown = prev->rampdown_steps;
|
prev_rampdown = prev->rampdown_steps;
|
||||||
prev_total_steps = prev->total_steps;
|
prev_total_steps = prev->total_steps;
|
||||||
}
|
ATOMIC_END
|
||||||
|
|
||||||
// The initial crossing speed is the minimum between both target speeds
|
// The initial crossing speed is the minimum between both target speeds
|
||||||
// Note: this is a given: the start speed and end speed can NEVER be
|
// Note: this is a given: the start speed and end speed can NEVER be
|
||||||
|
|
@ -453,7 +453,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
||||||
|
|
||||||
uint8_t timeout = 0;
|
uint8_t timeout = 0;
|
||||||
|
|
||||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
ATOMIC_START
|
||||||
// Evaluation: determine how we did...
|
// Evaluation: determine how we did...
|
||||||
lookahead_joined++;
|
lookahead_joined++;
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
||||||
la_cnt++;
|
la_cnt++;
|
||||||
} else
|
} else
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
}
|
ATOMIC_END
|
||||||
|
|
||||||
// If we were not fast enough, any feedback will happen outside the atomic block:
|
// If we were not fast enough, any feedback will happen outside the atomic block:
|
||||||
if(timeout) {
|
if(timeout) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue