From ab65ba6c9549788fcdc08b08a9d81fd6b916d9fe Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Mon, 18 Nov 2013 12:25:14 -0500 Subject: [PATCH] Rename delta -> delta_um to avoid collision. --- dda.c | 8 ++++---- dda.h | 2 +- dda_lookahead.c | 24 +++++++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dda.c b/dda.c index 985abb7..6772a4a 100644 --- a/dda.c +++ b/dda.c @@ -147,10 +147,10 @@ void dda_create(DDA *dda, TARGET *target, DDA *prev_dda) { #ifdef LOOKAHEAD // Also displacements in micrometers, but for the lookahead alogrithms. - dda->delta.X = target->X - startpoint.X; - dda->delta.Y = target->Y - startpoint.Y; - dda->delta.Z = target->Z - startpoint.Z; - dda->delta.E = target->e_relative ? target->E : target->E - startpoint.E; + dda->delta_um.X = target->X - startpoint.X; + dda->delta_um.Y = target->Y - startpoint.Y; + dda->delta_um.Z = target->Z - startpoint.Z; + dda->delta_um.E = target->e_relative ? target->E : target->E - startpoint.E; #endif if (DEBUG_DDA && (debug_flags & DEBUG_DDA)) diff --git a/dda.h b/dda.h index 1a4ebe2..32cc893 100644 --- a/dda.h +++ b/dda.h @@ -154,7 +154,7 @@ typedef struct { // 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. - VECTOR4D delta; + VECTOR4D delta_um; // Number the moves to be able to test at the end of lookahead if the moves // are the same. Note: we do not need a lot of granularity here: more than // MOVEBUFFER_SIZE is already enough. diff --git a/dda_lookahead.c b/dda_lookahead.c index 4318c7c..37c6d0c 100644 --- a/dda_lookahead.c +++ b/dda_lookahead.c @@ -59,9 +59,8 @@ uint32_t dda_steps_to_velocity(uint32_t steps) { } /** - * Determine the 'jerk' between 2 2D vectors and their speeds. The jerk can be used to obtain an - * acceptable speed for changing directions between moves. - * Vector delta is in um, speed is in mm/min. + * Determine the 'jerk' between 2 2D vectors and their speeds. The jerk can be + * used to obtain an acceptable speed for changing directions between moves. * @param x1 x component of first vector * @param y1 y component of first vector * @param F1 feed rate of first move @@ -99,7 +98,6 @@ int dda_jerk_size_2d_real(int32_t x1, int32_t y1, uint32_t F1, int32_t x2, int32 /** * Determine the 'jerk' for 2 1D vectors and their speeds. The jerk can be used to obtain an * acceptable speed for changing directions between moves. - * Vector delta is in um, speed is in mm/min. * @param x component of 1d vector - used to determine if we go back or forward * @param F feed rate */ @@ -122,7 +120,6 @@ int dda_jerk_size_1d(int32_t x1, uint32_t F1, int32_t x2, uint32_t F2) { * acceptable speed for changing directions between moves. * Instead of using 2 axis at once, consider the jerk for each axis individually and take the * upper limit between both. This ensures that each axis does not changes speed too fast. - * Vector delta is in um, speed is in mm/min. * @param x1 x component of first vector * @param y1 y component of first vector * @param F1 feed rate of first move @@ -192,20 +189,25 @@ void dda_join_moves(DDA *prev, DDA *current) { if ( ! prev || prev->nullmove) return; - serprintf(PSTR("Current Delta: %ld,%ld,%ld E:%ld Live:%d\r\n"), current->delta.X, current->delta.Y, current->delta.Z, current->delta.E, current->live); - serprintf(PSTR("Prev Delta: %ld,%ld,%ld E:%ld Live:%d\r\n"), prev->delta.X, prev->delta.Y, prev->delta.Z, prev->delta.E, prev->live); + serprintf(PSTR("Current Delta: %ld,%ld,%ld E:%ld Live:%d\r\n"), + current->delta_um.X, current->delta_um.Y, current->delta_um.Z, + current->delta_um.E, current->live); + serprintf(PSTR("Prev Delta: %ld,%ld,%ld E:%ld Live:%d\r\n"), + prev->delta_um.X, prev->delta_um.Y, prev->delta_um.Z, + prev->delta_um.E, prev->live); // Look-ahead: attempt to join moves into smooth movements // Note: moves are only modified after the calculations are complete. // Only prepare for look-ahead if we have 2 available moves to // join and the Z axis is unused (for now, Z axis moves are NOT joined). - if (prev->live == 0 && prev->delta.Z == current->delta.Z) { + if (prev->live == 0 && prev->delta_um.Z == current->delta_um.Z) { // Calculate the jerk if the previous move and this move would be joined // together at full speed. - jerk = dda_jerk_size_2d(prev->delta.X, prev->delta.Y, prev->endpoint.F, - current->delta.X, current->delta.Y, current->endpoint.F); + jerk = dda_jerk_size_2d(prev->delta_um.X, prev->delta_um.Y, prev->endpoint.F, + current->delta_um.X, current->delta_um.Y, current->endpoint.F); serprintf(PSTR("Jerk: %lu\r\n"), jerk); - jerk_e = dda_jerk_size_1d(prev->delta.E, prev->endpoint.F, current->delta.E, current->endpoint.F); + jerk_e = dda_jerk_size_1d(prev->delta_um.E, prev->endpoint.F, + current->delta_um.E, current->endpoint.F); serprintf(PSTR("Jerk_e: %lu\r\n"), jerk_e); } else { // Move already executing or Z moved: abort the join