DDA: remember number of the fast axis.

This commit is contained in:
Markus Hitter 2014-07-09 23:37:27 +02:00
parent 294f0eda26
commit 5ee2aebbed
2 changed files with 8 additions and 0 deletions

1
dda.c
View File

@ -230,6 +230,7 @@ void dda_create(DDA *dda, TARGET *target) {
// keep it for now. --Traumflug // keep it for now. --Traumflug
for (i = X; i < AXIS_COUNT; i++) { for (i = X; i < AXIS_COUNT; i++) {
if (i == X || dda->delta[i] > dda->total_steps) { if (i == X || dda->delta[i] > dda->total_steps) {
dda->fast_axis = i;
dda->total_steps = dda->delta[i]; dda->total_steps = dda->delta[i];
dda->fast_um = delta_um[i]; dda->fast_um = delta_um[i];
dda->fast_spm = pgm_read_dword(&steps_per_m_P[i]); dda->fast_spm = pgm_read_dword(&steps_per_m_P[i]);

7
dda.h
View File

@ -120,6 +120,7 @@ typedef struct {
// distances // distances
axes_uint32_t delta; ///< number of steps on each axis axes_uint32_t delta; ///< number of steps on each axis
// uint8_t fast_axis; (see below)
uint32_t total_steps; ///< steps of the "fast" axis uint32_t total_steps; ///< steps of the "fast" axis
uint32_t fast_um; ///< movement length of this fast axis uint32_t fast_um; ///< movement length of this fast axis
uint32_t fast_spm; ///< steps per meter of the fast axis uint32_t fast_spm; ///< steps per meter of the fast axis
@ -162,6 +163,12 @@ typedef struct {
uint8_t axis_to_step; ///< axis to be stepped on the next interrupt uint8_t axis_to_step; ///< axis to be stepped on the next interrupt
#endif #endif
/// Small variables. Many CPUs can access 32-bit variables at word or double
/// word boundaries only and fill smaller variables in between with gaps,
/// so keep small variables grouped together to reduce the amount of these
/// gaps. See e.g. NXP application note AN10963, page 10f.
uint8_t fast_axis; ///< number of the fast axis
/// Endstop homing /// Endstop homing
uint8_t endstop_check; ///< Do we need to check endstops? 0x1=Check X, 0x2=Check Y, 0x4=Check Z uint8_t endstop_check; ///< Do we need to check endstops? 0x1=Check X, 0x2=Check Y, 0x4=Check Z
uint8_t endstop_stop_cond; ///< Endstop condition on which to stop motion: 0=Stop on detrigger, 1=Stop on trigger uint8_t endstop_stop_cond; ///< Endstop condition on which to stop motion: 0=Stop on detrigger, 1=Stop on trigger