dda_lookahead.c/.h: #ifdef's around some debug-variables.

Move debug.h from .c to .h so debug-vars are available when DEBUG
is defined in debug.h.

Program -78 Bytes
Data -8 Bytes

No functional change.
This commit is contained in:
Wurstnase 2016-08-10 14:54:56 +02:00 committed by Markus Hitter
parent 4a5e28975e
commit 0e7165f22f
2 changed files with 17 additions and 7 deletions

View File

@ -17,15 +17,18 @@
#include "timer.h"
#include "delay.h"
#include "dda_queue.h"
#include "debug.h"
#include "sersendf.h"
#include "pinio.h"
#include "memory_barrier.h"
extern uint8_t use_lookahead;
uint32_t lookahead_joined = 0; // Total number of moves joined together
uint32_t lookahead_timeout = 0; // Moves that did not compute in time to be actually joined
#ifdef DEBUG
// Total number of moves joined together.
uint32_t lookahead_joined = 0;
// Moves that did not compute in time to be actually joined.
uint32_t lookahead_timeout = 0;
#endif
/// \var maximum_jerk_P
/// \brief maximum allowed feedrate jerk on each axis
@ -300,7 +303,9 @@ void dda_join_moves(DDA *prev, DDA *current) {
ATOMIC_START
// Evaluation: determine how we did...
lookahead_joined++;
#ifdef DEBUG
lookahead_joined++;
#endif
// Determine if we are fast enough - if not, just leave the moves
// Note: to test if the previous move was already executed and replaced by a new
@ -321,7 +326,9 @@ void dda_join_moves(DDA *prev, DDA *current) {
// If we were not fast enough, any feedback will happen outside the atomic block:
if(timeout) {
sersendf_P(PSTR("// Notice: look ahead not fast enough\n"));
lookahead_timeout++;
#ifdef DEBUG
lookahead_timeout++;
#endif
}
}
}

View File

@ -4,6 +4,7 @@
#include <stdint.h>
#include "config_wrapper.h"
#include "dda.h"
#include "debug.h"
#ifdef LOOKAHEAD
@ -28,8 +29,10 @@ void dda_find_crossing_speed(DDA *prev, DDA *current);
void dda_join_moves(DDA *prev, DDA *current);
// Debug counters
extern uint32_t lookahead_joined;
extern uint32_t lookahead_timeout;
#ifdef DEBUG
extern uint32_t lookahead_joined;
extern uint32_t lookahead_timeout;
#endif
#endif /* LOOKAHEAD */
#endif /* DDA_LOOKAHEAD_H_ */