DDA: calculate acceleration for the actual fast axis.
This finally brings Z axis up to speed. So far we always assumed the fastest axis to have the same steps/mm as the X axis. In cases where this wasn't true, the movement wouldn't do sufficient acceleration steps and, accordingly, not reach the expected maximum speed. This was particularly visible on a typical Mendel printer, where the Z axis would reach only a 6th of the commanded speed in some configurations.
This commit is contained in:
parent
5ee2aebbed
commit
4f0a00c1a6
12
dda.c
12
dda.c
|
|
@ -395,14 +395,15 @@ void dda_create(DDA *dda, TARGET *target) {
|
|||
dda_join_moves(prev_dda, dda);
|
||||
dda->n = dda->start_steps;
|
||||
if (dda->n == 0)
|
||||
dda->c = pgm_read_dword(&c0_P[X]);
|
||||
dda->c = pgm_read_dword(&c0_P[dda->fast_axis]);
|
||||
else
|
||||
dda->c = ((pgm_read_dword(&c0_P[X]) >> 8) * int_inv_sqrt(dda->n)) >> 5;
|
||||
dda->c = ((pgm_read_dword(&c0_P[dda->fast_axis]) >> 8) *
|
||||
int_inv_sqrt(dda->n)) >> 5;
|
||||
if (dda->c < dda->c_min)
|
||||
dda->c = dda->c_min;
|
||||
#else
|
||||
dda->n = 0;
|
||||
dda->c = pgm_read_dword(&c0_P[X]);
|
||||
dda->c = pgm_read_dword(&c0_P[dda->fast_axis]);
|
||||
#endif
|
||||
|
||||
#elif defined ACCELERATION_TEMPORAL
|
||||
|
|
@ -865,11 +866,12 @@ void dda_clock() {
|
|||
}
|
||||
if (recalc_speed) {
|
||||
if (dda->n == 0)
|
||||
move_c = pgm_read_dword(&c0_P[X]);
|
||||
move_c = pgm_read_dword(&c0_P[dda->fast_axis]);
|
||||
else
|
||||
// Explicit formula: c0 * (sqrt(n + 1) - sqrt(n)),
|
||||
// approximation here: c0 * (1 / (2 * sqrt(n))).
|
||||
move_c = ((pgm_read_dword(&c0_P[X]) >> 8) * int_inv_sqrt(dda->n)) >> 5;
|
||||
move_c = ((pgm_read_dword(&c0_P[dda->fast_axis]) >> 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue