look-ahead: take F_end into account on acceleration calculations.
This commit is contained in:
parent
83433cb071
commit
da77b678e3
7
dda.c
7
dda.c
|
|
@ -101,6 +101,7 @@ void dda_create(DDA *dda, TARGET *target, DDA *prev_dda) {
|
|||
dda->F_start = 0;
|
||||
dda->start_steps = 0;
|
||||
dda->F_end = 0;
|
||||
dda->end_steps = 0;
|
||||
// Give this move an identifier.
|
||||
dda->id = idcnt++;
|
||||
#endif
|
||||
|
|
@ -796,7 +797,11 @@ void dda_clock() {
|
|||
recalc_speed = 1;
|
||||
}
|
||||
else if (move_step_no >= dda->rampdown_steps) {
|
||||
dda->n = dda->total_steps - move_step_no;
|
||||
#ifdef LOOKAHEAD
|
||||
dda->n = dda->total_steps - move_step_no + dda->end_steps;
|
||||
#else
|
||||
dda->n = dda->total_steps - move_step_no;
|
||||
#endif
|
||||
recalc_speed = 1;
|
||||
}
|
||||
if (recalc_speed) {
|
||||
|
|
|
|||
1
dda.h
1
dda.h
|
|
@ -149,6 +149,7 @@ typedef struct {
|
|||
uint32_t F_start;
|
||||
uint32_t start_steps; ///< steps to reach F_start
|
||||
uint32_t F_end;
|
||||
uint32_t end_steps; ///< steps to stop from F_end
|
||||
// Displacement vector, in um, based between the difference of the starting
|
||||
// point and the target. Required to obtain the jerk between 2 moves.
|
||||
// Note: x_delta and co are in steps, not um.
|
||||
|
|
|
|||
|
|
@ -171,7 +171,8 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
|||
// Calculating the look-ahead settings can take a while; before modifying
|
||||
// the previous move, we need to locally store any values and write them
|
||||
// when we are done (and the previous move is not already active).
|
||||
uint32_t prev_F, prev_F_start, prev_F_end, prev_rampup, prev_rampdown, prev_total_steps;
|
||||
uint32_t prev_F, prev_F_start, prev_F_end, prev_end;
|
||||
uint32_t prev_rampup, prev_rampdown, prev_total_steps;
|
||||
uint8_t prev_id;
|
||||
// Similarly, we only want to modify the current move if we have the results of the calculations;
|
||||
// until then, we do not want to touch the current move settings.
|
||||
|
|
@ -341,6 +342,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
|||
prev_rampup = up;
|
||||
prev_rampdown = prev_total_steps - down;
|
||||
prev_F_end = crossF;
|
||||
prev_end = ACCELERATE_RAMP_LEN(prev_F_end);
|
||||
|
||||
#ifdef LOOKAHEAD_DEBUG
|
||||
// Sanity check: make sure the speed limits are maintained
|
||||
|
|
@ -437,6 +439,7 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
|||
prev_rampup = up2;
|
||||
prev_rampdown = prev_total_steps - down2;
|
||||
prev_F_end = crossF;
|
||||
prev_end = ACCELERATE_RAMP_LEN(prev_F_end);
|
||||
}
|
||||
|
||||
#ifdef LOOKAHEAD_DEBUG
|
||||
|
|
@ -463,11 +466,13 @@ void dda_join_moves(DDA *prev, DDA *current) {
|
|||
// move, we compare the DDA id.
|
||||
if(prev->live == 0 && prev->id == prev_id) {
|
||||
prev->F_end = prev_F_end;
|
||||
prev->end_steps = prev_end;
|
||||
prev->rampup_steps = prev_rampup;
|
||||
prev->rampdown_steps = prev_rampdown;
|
||||
current->rampup_steps = this_rampup;
|
||||
current->rampdown_steps = this_rampdown;
|
||||
current->F_end = 0;
|
||||
current->end_steps = 0;
|
||||
current->F_start = this_F_start;
|
||||
current->start_steps = this_start;
|
||||
la_cnt++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue