DDA: make lookahead independent of X.

We calculate all steps from the fastest axis now. So X and Y
steps_per_m don't have to be the same anymore.

Traumflug's: another 16 bytes program size off on AVR, same size
on LPC1114.
This commit is contained in:
wurstnase 2016-07-11 19:00:53 +02:00 committed by Markus Hitter
parent 2b1f3371c7
commit 5b11a39155
2 changed files with 5 additions and 8 deletions

View File

@ -172,7 +172,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
// until then, we do not want to touch the current move settings. // until then, we do not want to touch the current move settings.
// Note: we assume 'current' will not be dispatched while this function runs, so we do not to // Note: we assume 'current' will not be dispatched while this function runs, so we do not to
// back up the move settings: they will remain constant. // back up the move settings: they will remain constant.
uint32_t this_F, this_F_in_steps, this_F_start_in_steps, this_rampup, this_rampdown, this_total_steps; uint32_t this_F, this_F_in_steps, this_F_start_in_steps, this_rampup, this_rampdown, this_total_steps, this_fast_axis;
uint8_t this_id; uint8_t this_id;
static uint32_t la_cnt = 0; // Counter: how many moves did we join? static uint32_t la_cnt = 0; // Counter: how many moves did we join?
#ifdef LOOKAHEAD_DEBUG #ifdef LOOKAHEAD_DEBUG
@ -203,6 +203,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
this_id = current->id; this_id = current->id;
this_F = current->endpoint.F; this_F = current->endpoint.F;
this_total_steps = current->total_steps; this_total_steps = current->total_steps;
this_fast_axis = current->fast_axis;
ATOMIC_END ATOMIC_END
// Here we have to distinguish between feedrate along the movement // Here we have to distinguish between feedrate along the movement
@ -217,10 +218,9 @@ void dda_join_moves(DDA *prev, DDA *current) {
this_F = muldiv(current->fast_um, current->endpoint.F, current->distance); this_F = muldiv(current->fast_um, current->endpoint.F, current->distance);
crossF = muldiv(current->fast_um, crossF, current->distance); crossF = muldiv(current->fast_um, crossF, current->distance);
// TODO: calculate the steps from the fastest axis and not from X. prev_F_in_steps = acc_ramp_len(prev_F, this_fast_axis);
prev_F_in_steps = ACCELERATE_RAMP_LEN(prev_F); this_F_in_steps = acc_ramp_len(this_F, this_fast_axis);
this_F_in_steps = ACCELERATE_RAMP_LEN(this_F); crossF_in_steps = acc_ramp_len(crossF, this_fast_axis);
crossF_in_steps = ACCELERATE_RAMP_LEN(crossF);
// Show the proposed crossing speed - this might get adjusted below // Show the proposed crossing speed - this might get adjusted below
if (DEBUG_DDA && (debug_flags & DEBUG_DDA)) if (DEBUG_DDA && (debug_flags & DEBUG_DDA))

View File

@ -53,7 +53,4 @@ const uint8_t msbloc (uint32_t v);
// Calculates acceleration ramp length in steps. // Calculates acceleration ramp length in steps.
uint32_t acc_ramp_len(uint32_t feedrate, uint8_t fast_axis); uint32_t acc_ramp_len(uint32_t feedrate, uint8_t fast_axis);
// For X axis only, should become obsolete:
#define ACCELERATE_RAMP_LEN(speed) (((speed)*(speed)) / (uint32_t)((7200000.0f * ACCELERATION) / (float)STEPS_PER_M_X))
#endif /* _DDA_MATHS_H */ #endif /* _DDA_MATHS_H */