DDA: use the already calculated distance for crossing speed calculation.
This commit is contained in:
parent
3ac26f0cab
commit
da5339d163
2
dda.c
2
dda.c
|
|
@ -362,7 +362,7 @@ void dda_create(DDA *dda, TARGET *target) {
|
|||
dda->rampdown_steps = dda->total_steps - dda->rampup_steps;
|
||||
|
||||
#ifdef LOOKAHEAD
|
||||
dda_find_crossing_speed(prev_dda, dda);
|
||||
dda_find_crossing_speed(prev_dda, dda, distance);
|
||||
// TODO: this should become a reverse-stepping through the existing
|
||||
// movement queue to allow higher speeds for short moves.
|
||||
// dda_find_crossing_speed() is required only once.
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ void dda_emergency_shutdown(PGM_P msg) {
|
|||
*
|
||||
* \return dda->crossF
|
||||
*/
|
||||
void dda_find_crossing_speed(DDA *prev, DDA *current) {
|
||||
uint32_t F, prev_distance, curr_distance;
|
||||
void dda_find_crossing_speed(DDA *prev, DDA *current, uint32_t curr_distance) {
|
||||
uint32_t F, prev_distance;
|
||||
uint32_t dv, speed_factor, max_speed_factor;
|
||||
int32_t prevFx, prevFy, prevFz, prevFe;
|
||||
int32_t currFx, currFy, currFz, currFe;
|
||||
|
|
@ -181,18 +181,13 @@ void dda_find_crossing_speed(DDA *prev, DDA *current) {
|
|||
if (current->endpoint.F < F)
|
||||
F = current->endpoint.F;
|
||||
|
||||
// Find out movement distances.
|
||||
// TODO: remember these from dda_start();
|
||||
// Find out movement distance of the previous move.
|
||||
// TODO: remember this from the previous call of dda_find_crossing_speed().
|
||||
prev_distance = approx_distance_3(
|
||||
prev->x_direction ? prev->delta_um.X : - prev->delta_um.X,
|
||||
prev->y_direction ? prev->delta_um.Y : - prev->delta_um.Y,
|
||||
prev->z_direction ? prev->delta_um.Z : - prev->delta_um.Z);
|
||||
|
||||
curr_distance = approx_distance_3(
|
||||
current->x_direction ? current->delta_um.X : - current->delta_um.X,
|
||||
current->y_direction ? current->delta_um.Y : - current->delta_um.Y,
|
||||
current->z_direction ? current->delta_um.Z : - current->delta_um.Z);
|
||||
|
||||
if (DEBUG_DDA && (debug_flags & DEBUG_DDA))
|
||||
sersendf_P(PSTR("Distance: %lu, then %lu\n"), prev_distance, curr_distance);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
|
||||
void dda_find_crossing_speed(DDA *prev, DDA *current);
|
||||
void dda_find_crossing_speed(DDA *prev, DDA *current, uint32_t curr_distance);
|
||||
void dda_join_moves(DDA *prev, DDA *current);
|
||||
|
||||
// Debug counters
|
||||
|
|
|
|||
Loading…
Reference in New Issue