dda->id is needed even when !LOOKAHEAD

In `ACCELERATION_RAMPING` code we use the dda->id field even when we do
not enable `LOOKAHEAD`. Expose the variable and its related `idcnt`
when `ACCELERATION_RAMPING` is used.

Add a regression-test to catch this in the future.
This commit is contained in:
Phil Hord 2017-02-01 10:21:48 -08:00
parent 80136a51d8
commit 1e9cb8b8e1
4 changed files with 16 additions and 2 deletions

View File

@ -158,6 +158,9 @@ regressiontests:
# Config scenario: no endstops defined # Config scenario: no endstops defined
$(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-no-endstops.h \ $(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-no-endstops.h \
MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all
# Config scenario: ACCELERATION_RAMPING without LOOKAHEAD
$(MAKE) -f Makefile-AVR USER_CONFIG=testcases/config.regtest-no-lookahead.h \
MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all
# Don't forget the hostside simulator. # Don't forget the hostside simulator.
$(MAKE) -f Makefile-SIM USER_CONFIG=testcases/config.regtest-gen7-avr.h \ $(MAKE) -f Makefile-SIM USER_CONFIG=testcases/config.regtest-gen7-avr.h \
MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all MCU=atmega644 F_CPU=20000000UL EXTRA_CFLAGS=-Werror all

6
dda.c
View File

@ -154,9 +154,11 @@ void dda_create(DDA *dda, const TARGET *target) {
axes_int32_t steps; axes_int32_t steps;
uint32_t distance, c_limit, c_limit_calc; uint32_t distance, c_limit, c_limit_calc;
enum axis_e i; enum axis_e i;
#ifdef LOOKAHEAD #ifdef ACCELERATION_RAMPING
// Number the moves to identify them; allowed to overflow. // Number the moves to identify them; allowed to overflow.
static uint8_t idcnt = 0; static uint8_t idcnt = 0;
#endif
#ifdef LOOKAHEAD
static DDA* prev_dda = NULL; static DDA* prev_dda = NULL;
if (prev_dda && prev_dda->done) if (prev_dda && prev_dda->done)
@ -184,6 +186,8 @@ void dda_create(DDA *dda, const TARGET *target) {
dda->crossF = 0; dda->crossF = 0;
dda->start_steps = 0; dda->start_steps = 0;
dda->end_steps = 0; dda->end_steps = 0;
#endif
#ifdef ACCELERATION_RAMPING
// Give this move an identifier. // Give this move an identifier.
dda->id = idcnt++; dda->id = idcnt++;
#endif #endif

2
dda.h
View File

@ -134,11 +134,11 @@ typedef struct {
// These two are based on the "fast" axis, the axis with the most steps. // These two are based on the "fast" axis, the axis with the most steps.
uint32_t start_steps; ///< would be required to reach start feedrate uint32_t start_steps; ///< would be required to reach start feedrate
uint32_t end_steps; ///< would be required to stop from end feedrate uint32_t end_steps; ///< would be required to stop from end feedrate
#endif
// Number the moves to be able to test at the end of lookahead if the moves // Number the moves to be able to test at the end of lookahead if the moves
// are the same. Note: we do not need a lot of granularity here: more than // are the same. Note: we do not need a lot of granularity here: more than
// MOVEBUFFER_SIZE is already enough. // MOVEBUFFER_SIZE is already enough.
uint8_t id; uint8_t id;
#endif
#endif #endif
#ifdef ACCELERATION_TEMPORAL #ifdef ACCELERATION_TEMPORAL
axes_uint32_t step_interval; ///< time between steps on each axis axes_uint32_t step_interval; ///< time between steps on each axis

View File

@ -0,0 +1,7 @@
// Configuration for controller board.
#include "../config/board.gen7-v1.4.h"
// Configuration for printer board.
#include "../config/printer.wolfstrap.h"
#undef LOOKAHEAD