diff --git a/dda.c b/dda.c index 48046dd..16b8c3c 100644 --- a/dda.c +++ b/dda.c @@ -230,6 +230,7 @@ void dda_create(DDA *dda, TARGET *target) { // keep it for now. --Traumflug for (i = X; i < AXIS_COUNT; i++) { if (i == X || dda->delta[i] > dda->total_steps) { + dda->fast_axis = i; dda->total_steps = dda->delta[i]; dda->fast_um = delta_um[i]; dda->fast_spm = pgm_read_dword(&steps_per_m_P[i]); diff --git a/dda.h b/dda.h index 4730353..a9faa4e 100644 --- a/dda.h +++ b/dda.h @@ -120,6 +120,7 @@ typedef struct { // distances 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 fast_um; ///< movement length of this 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 #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 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