From a36b96357e67ba09f7632a4a4be46e63f7d681ef Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Thu, 16 Oct 2014 20:47:46 +0200 Subject: [PATCH] CoreXY, dda.c: start by making steps an array. Goal is to calculate steps in a separate function to allow different methods of steps calculation, which is neccessary for supporting different kinematics types. Accordingly we have to calculate steps for all axes before setting directions and such stuff. --- dda.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dda.c b/dda.c index 8d53256..8c859e0 100644 --- a/dda.c +++ b/dda.c @@ -155,8 +155,8 @@ void dda_new_startpoint(void) { * already. */ void dda_create(DDA *dda, TARGET *target) { - uint32_t steps; axes_uint32_t delta_um; + axes_int32_t steps; uint32_t distance, c_limit, c_limit_calc; enum axis_e i; #ifdef LOOKAHEAD @@ -192,9 +192,9 @@ void dda_create(DDA *dda, TARGET *target) { for (i = X; i < (target->e_relative ? E : AXIS_COUNT); i++) { delta_um[i] = (uint32_t)abs32(target->axis[i] - startpoint.axis[i]); - steps = um_to_steps(target->axis[i], i); - dda->delta[i] = abs32(steps - startpoint_steps.axis[i]); - startpoint_steps.axis[i] = steps; + steps[i] = um_to_steps(target->axis[i], i); + dda->delta[i] = (uint32_t)abs32(steps[i] - startpoint_steps.axis[i]); + startpoint_steps.axis[i] = steps[i]; set_direction(dda, i, (target->axis[i] >= startpoint.axis[i])?1:0); #ifdef LOOKAHEAD