From 0e7165f22f9c35d6d5ae8ef2e695c0c8983e809a Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Wed, 10 Aug 2016 14:54:56 +0200 Subject: [PATCH] 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. --- dda_lookahead.c | 17 ++++++++++++----- dda_lookahead.h | 7 +++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dda_lookahead.c b/dda_lookahead.c index 76fab02..e36af36 100644 --- a/dda_lookahead.c +++ b/dda_lookahead.c @@ -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 } } } diff --git a/dda_lookahead.h b/dda_lookahead.h index 7edafc1..4dc6f98 100644 --- a/dda_lookahead.h +++ b/dda_lookahead.h @@ -4,6 +4,7 @@ #include #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_ */