diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 4640a517..08db73c6 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -270,6 +270,7 @@ struct __MoDriv { int rotary_count; /**< count of rotations */ char ao_id[256]; bool legacy_fsm; /**< flag for legacy_fsm new code */ + bool status_valid; /**< flag for status has been set from controller */ bool doStats; /**< flag to request stats collection */ double S_x; double S_y; @@ -1800,7 +1801,7 @@ static int rspStatus(pDMC2280Driv self, const char* text) { self->currSteps = iSteps; if (self->bias_bits > 0) iCounts = (iCounts + self->bias_bias) & ((1 << self->bias_bits) - 1); - if (self->rotary_bits > 0) { + if (self->rotary_bits > 0 && self->status_valid) { int shift = 2; int mask = (1 << shift) - 1; int old_bits = (self->currCounts >> (self->rotary_bits - shift)) & mask; @@ -1848,6 +1849,7 @@ static int rspStatus(pDMC2280Driv self, const char* text) { else self->stopCode = 1; } + self->status_valid = true; return 1; }