CoreXY, dda.c: use our now signed delta_steps to set direction.
This nicely makes the binary 36 bytes smaller.
This commit is contained in:
parent
12f01a783a
commit
cca464260b
8
dda.c
8
dda.c
|
|
@ -83,7 +83,9 @@ static const axes_uint32_t PROGMEM c0_P = {
|
||||||
|
|
||||||
/*! Set the direction of the 'n' axis
|
/*! Set the direction of the 'n' axis
|
||||||
*/
|
*/
|
||||||
static void set_direction(DDA *dda, enum axis_e n, int dir) {
|
static void set_direction(DDA *dda, enum axis_e n, int32_t delta) {
|
||||||
|
uint8_t dir = (delta >= 0) ? 1 : 0;
|
||||||
|
|
||||||
if (n == X)
|
if (n == X)
|
||||||
dda->x_direction = dir;
|
dda->x_direction = dir;
|
||||||
else if (n == Y)
|
else if (n == Y)
|
||||||
|
|
@ -199,7 +201,7 @@ void dda_create(DDA *dda, TARGET *target) {
|
||||||
dda->delta[i] = (uint32_t)abs32(delta_steps);
|
dda->delta[i] = (uint32_t)abs32(delta_steps);
|
||||||
startpoint_steps.axis[i] = steps[i];
|
startpoint_steps.axis[i] = steps[i];
|
||||||
|
|
||||||
set_direction(dda, i, (target->axis[i] >= startpoint.axis[i])?1:0);
|
set_direction(dda, i, delta_steps);
|
||||||
#ifdef LOOKAHEAD
|
#ifdef LOOKAHEAD
|
||||||
// Also displacements in micrometers, but for the lookahead alogrithms.
|
// Also displacements in micrometers, but for the lookahead alogrithms.
|
||||||
// TODO: this is redundant. delta_um[] and dda->delta_um[] differ by
|
// TODO: this is redundant. delta_um[] and dda->delta_um[] differ by
|
||||||
|
|
@ -220,7 +222,7 @@ void dda_create(DDA *dda, TARGET *target) {
|
||||||
dda->delta[E] = (uint32_t)abs32(delta_steps);
|
dda->delta[E] = (uint32_t)abs32(delta_steps);
|
||||||
startpoint_steps.axis[E] = steps[E];
|
startpoint_steps.axis[E] = steps[E];
|
||||||
|
|
||||||
set_direction(dda, E, (target->axis[E] >= startpoint.axis[E]) ? 1 : 0);
|
set_direction(dda, E, delta_steps);
|
||||||
#ifdef LOOKAHEAD
|
#ifdef LOOKAHEAD
|
||||||
// Also displacements in micrometers, but for the lookahead alogrithms.
|
// Also displacements in micrometers, but for the lookahead alogrithms.
|
||||||
// TODO: this is redundant. delta_um[] and dda->delta_um[] differ by
|
// TODO: this is redundant. delta_um[] and dda->delta_um[] differ by
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue