dda.c: add some TODOs about duplicate and redundant code.

This commit is contained in:
Markus Hitter 2014-10-17 18:36:03 +02:00
parent 69e0b0d15e
commit 9fe9c919a4
2 changed files with 14 additions and 0 deletions

8
dda.c
View File

@ -205,11 +205,19 @@ void dda_create(DDA *dda, TARGET *target) {
// just signedness and storage location. Ideally, dda is used
// as storage place only if neccessary (LOOKAHEAD turned on?)
// because this space is multiplied by the movement queue size.
//
// Update 2014/10: it was tried to use delta_um[]'s sign to set stepper
// direction in dda_start() to allow getting rid of
// some of this redundancy, but this increases dda_start()
// by at least 20 clock cycles. Not good for performance.
// Tried code can be found in the archive folder.
dda->delta_um[i] = (delta_steps >= 0) ?
(int32_t)delta_um[i] : -(int32_t)delta_um[i];
#endif
}
// TODO: this can likely be, at least partially, joined with the above for()
// loop. Lots of almost-duplicate code.
if ( ! target->e_relative) {
int32_t delta_steps;

View File

@ -193,6 +193,12 @@ void dda_find_crossing_speed(DDA *prev, DDA *current) {
prev->distance, current->distance);
// Find individual axis speeds.
// TODO: this is eight expensive muldiv()s. It should be possible to store
// currF as prevF for the next calculation somehow, to save 4 of
// these 8 muldiv()s. This would also allow to get rid of
// dda->delta_um[] and using delta_um[] from dda_create() instead.
// Caveat: bail out condition above and some other non-continuous
// situations might need some extra code for handling.
for (i = X; i < AXIS_COUNT; i++) {
prevF[i] = muldiv(prev->delta_um[i], F, prev->distance);
currF[i] = muldiv(current->delta_um[i], F, current->distance);