dda.c: remove the hack for too high rampup steps for lookahead.
Keeping the hack causes the previous move to decelerate, which isn't intended when movements are joined with lookahead. Removing only the hack breaks endstop handling on those axes which set a huuuge number of acceleration steps for the lack of a proper calculation algorithm. We have this algorithm now, so we can stop using this kludge. Solves part 1 of issue #68.
This commit is contained in:
parent
2f1142d461
commit
20686eb52c
20
dda.c
20
dda.c
|
|
@ -368,13 +368,6 @@ void dda_create(DDA *dda, TARGET *target) {
|
|||
}
|
||||
dda->rampup_steps = ACCELERATE_RAMP_LEN(muldiv(fast_um, dda->endpoint.F, distance));
|
||||
|
||||
// Quick hack: we do not do Z move joins as jerk on the Z axis is undesirable;
|
||||
// as the ramp length is calculated for XY, its incorrect for Z: apply the original
|
||||
// 'fix' to simply specify a large enough ramp for any speed.
|
||||
if (x_delta_um == 0 && y_delta_um == 0) {
|
||||
dda->rampup_steps = 1000000; // replace mis-calculation by a safe value
|
||||
}
|
||||
|
||||
if (dda->rampup_steps > dda->total_steps / 2)
|
||||
dda->rampup_steps = dda->total_steps / 2;
|
||||
dda->rampdown_steps = dda->total_steps - dda->rampup_steps;
|
||||
|
|
@ -867,6 +860,9 @@ void dda_clock() {
|
|||
// approximation here: c0 * (1 / (2 * sqrt(n))).
|
||||
move_c = ((C0 >> 8) * int_inv_sqrt(dda->n)) >> 5;
|
||||
|
||||
// TODO: most likely this whole check is obsolete. It was left as a
|
||||
// safety margin, only. Rampup steps calculation should be accurate
|
||||
// now and give the requested target speed within a few percent.
|
||||
if (move_c < dda->c_min) {
|
||||
// We hit max speed not always exactly.
|
||||
move_c = dda->c_min;
|
||||
|
|
@ -874,14 +870,8 @@ void dda_clock() {
|
|||
// This is a hack which deals with movements with an unknown number of
|
||||
// acceleration steps. dda_create() sets a very high number, then,
|
||||
// but we don't want to re-calculate all the time.
|
||||
// This hack doesn't work with (and isn't neccessary for) movements
|
||||
// accelerated by look-ahead.
|
||||
#ifdef LOOKAHEAD
|
||||
if (dda->crossF == 0) { // For example, endstop searches.
|
||||
dda->rampup_steps = move_step_no;
|
||||
dda->rampdown_steps = dda->total_steps - dda->rampup_steps;
|
||||
}
|
||||
#else // Without LOOKAHEAD, there's no dda->crossF.
|
||||
// This hack doesn't work with lookahead.
|
||||
#ifndef LOOKAHEAD
|
||||
dda->rampup_steps = move_step_no;
|
||||
dda->rampdown_steps = dda->total_steps - dda->rampup_steps;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue