diff --git a/dda.c b/dda.c index 9fdf6d3..80e5816 100644 --- a/dda.c +++ b/dda.c @@ -119,8 +119,7 @@ void dda_create(DDA *dda, TARGET *target) { uint32_t distance; // initialise DDA to a known state - dda->live = 0; - dda->waitfor_temp = 0; + dda->allflags = 0; if (debug_flags & DEBUG_DDA) serial_writestr_P(PSTR("\n{DDA_CREATE: [")); diff --git a/dda.h b/dda.h index d775b70..2248f10 100644 --- a/dda.h +++ b/dda.h @@ -24,19 +24,24 @@ typedef struct { // this is where we should finish TARGET endpoint; - // status fields - uint8_t nullmove :1; - uint8_t live :1; - uint8_t accel :1; + union { + struct { + // status fields + uint8_t nullmove :1; + uint8_t live :1; + uint8_t accel :1; - // wait for temperature to stabilise flag - uint8_t waitfor_temp :1; + // wait for temperature to stabilise flag + uint8_t waitfor_temp :1; - // directions - uint8_t x_direction :1; - uint8_t y_direction :1; - uint8_t z_direction :1; - uint8_t e_direction :1; + // directions + uint8_t x_direction :1; + uint8_t y_direction :1; + uint8_t z_direction :1; + uint8_t e_direction :1; + }; + uint8_t allflags; // used for clearing all flags + }; // distances uint32_t x_delta;