Revert "DDA: use bitmask to track active axes [...]"
While this was an improvement of 9 clocks on AVRs, it had more than the opposite effect on ARMs: 25 clocks slower on the slowest step. Apparently ARMs aren't as efficient in reading and writing single bits. https://github.com/Traumflug/Teacup_Firmware/issues/189#issuecomment-262837660 Performance on AVR is back to what we had before: ATmega sizes '168 '328(P) '644(P) '1280 Program: 19610 bytes 137% 64% 31% 16% Data: 2175 bytes 213% 107% 54% 27% EEPROM: 32 bytes 4% 2% 2% 1% short-moves.gcode statistics: LED on occurences: 888. LED on time minimum: 280 clock cycles. LED on time maximum: 549 clock cycles. LED on time average: 286.273 clock cycles. smooth-curves.gcode statistics: LED on occurences: 23648. LED on time minimum: 272 clock cycles. LED on time maximum: 580 clock cycles. LED on time average: 307.439 clock cycles. triangle-odd.gcode statistics: LED on occurences: 1636. LED on time minimum: 272 clock cycles. LED on time maximum: 539 clock cycles. LED on time average: 297.732 clock cycles.
This commit is contained in:
parent
00a28cd502
commit
3ba52e5906
14
dda.c
14
dda.c
|
|
@ -187,7 +187,6 @@ void dda_create(DDA *dda, const TARGET *target) {
|
|||
dda->id = idcnt++;
|
||||
#endif
|
||||
|
||||
dda->active_axes = 0;
|
||||
// Handle bot axes. They're subject to kinematics considerations.
|
||||
code_axes_to_stepper_axes(&startpoint, target, delta_um, steps);
|
||||
for (i = X; i < E; i++) {
|
||||
|
|
@ -195,8 +194,6 @@ void dda_create(DDA *dda, const TARGET *target) {
|
|||
|
||||
delta_steps = steps[i] - startpoint_steps.axis[i];
|
||||
dda->delta[i] = (uint32_t)labs(delta_steps);
|
||||
if (delta_steps)
|
||||
dda->active_axes |= 1 << i;
|
||||
startpoint_steps.axis[i] = steps[i];
|
||||
|
||||
set_direction(dda, i, delta_steps);
|
||||
|
|
@ -258,9 +255,6 @@ void dda_create(DDA *dda, const TARGET *target) {
|
|||
dda->e_direction = (target->axis[E] >= 0)?1:0;
|
||||
}
|
||||
|
||||
if (dda->delta[E])
|
||||
dda->active_axes |= 1 << E;
|
||||
|
||||
if (DEBUG_DDA && (debug_flags & DEBUG_DDA))
|
||||
sersendf_P(PSTR("[%ld,%ld,%ld,%ld]"),
|
||||
target->axis[X] - startpoint.axis[X], target->axis[Y] - startpoint.axis[Y],
|
||||
|
|
@ -572,28 +566,28 @@ void dda_start(DDA *dda) {
|
|||
void dda_step(DDA *dda) {
|
||||
|
||||
#if ! defined ACCELERATION_TEMPORAL
|
||||
if (dda->active_axes & (1 << X)) {
|
||||
if (dda->delta[X]) {
|
||||
move_state.counter[X] -= dda->delta[X];
|
||||
if (move_state.counter[X] < 0) {
|
||||
x_step();
|
||||
move_state.counter[X] += dda->total_steps;
|
||||
}
|
||||
}
|
||||
if (dda->active_axes & (1 << Y)) {
|
||||
if (dda->delta[Y]) {
|
||||
move_state.counter[Y] -= dda->delta[Y];
|
||||
if (move_state.counter[Y] < 0) {
|
||||
y_step();
|
||||
move_state.counter[Y] += dda->total_steps;
|
||||
}
|
||||
}
|
||||
if (dda->active_axes & (1 << Z)) {
|
||||
if (dda->delta[Z]) {
|
||||
move_state.counter[Z] -= dda->delta[Z];
|
||||
if (move_state.counter[Z] < 0) {
|
||||
z_step();
|
||||
move_state.counter[Z] += dda->total_steps;
|
||||
}
|
||||
}
|
||||
if (dda->active_axes & (1 << E)) {
|
||||
if (dda->delta[E]) {
|
||||
move_state.counter[E] -= dda->delta[E];
|
||||
if (move_state.counter[E] < 0) {
|
||||
e_step();
|
||||
|
|
|
|||
1
dda.h
1
dda.h
|
|
@ -156,7 +156,6 @@ typedef struct {
|
|||
/// 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 active_axes; ///< Bit mask of moving axes
|
||||
uint8_t fast_axis; ///< number of the fast axis
|
||||
|
||||
/// Endstop homing
|
||||
|
|
|
|||
Loading…
Reference in New Issue