diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 043f1375..694a76b9 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -187,6 +187,8 @@ struct __MoDriv { double origTime; /**< Time at motor start */ int origSteps; int origCounts; + double moveStartTime; + double moveStopTime; double minPosition; /**< min position during move */ double maxPosition; /**< max position during move */ double minRatio; @@ -2454,6 +2456,8 @@ static void DMCState_MotorOn(pDMC2280Driv self, pEvtEvent event) { #endif self->minPosition = self->currPosition; self->maxPosition = self->currPosition; + self->stepCount = 0; + self->moveStartTime = DoubleTime(); if (self->testing) { self->myNextState = NULL; if (self->backlash_offset != 0) { @@ -3027,7 +3031,7 @@ static void DMCState_StepMove(pDMC2280Driv self, pEvtEvent event) { self->maxRatio = 0.0; /* begin moving */ cmdBegin(self); - self->stepCount = 1; + self->stepCount++; self->subState = 1; return; case eTimerEvent: @@ -3069,6 +3073,7 @@ static void DMCState_StepMove(pDMC2280Driv self, pEvtEvent event) { /* * We get here when the motor stops normally */ + self->moveStopTime = DoubleTime(); if (self->doSettle) { self->doSettle = false; DMC_SetTimer(self, self->settle); @@ -3363,6 +3368,7 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) { } /* We get here when the motor stops normally */ + self->moveStopTime = DoubleTime(); if (true /*self->debug*/) { double units = self->currPosition - self->origPosition; long int steps = self->currSteps - self->origSteps; @@ -5175,6 +5181,22 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon, line, eValue); return 1; } + else if(strcasecmp("stepCount", argv[1]) == 0) { + char line[132]; + snprintf(line, 132, "%s.stepCount = %d", + self->name, + self->stepCount); + SCWrite(pCon, line, eValue); + return 1; + } + else if(strcasecmp("moveTime", argv[1]) == 0) { + char line[132]; + snprintf(line, 132, "%s.moveTime = %.6f", + self->name, + self->moveStopTime - self->moveStartTime); + SCWrite(pCon, line, eValue); + return 1; + } else if(strcasecmp("testing", argv[1]) == 0) { if (argc > 2) { if (strcasecmp("on", argv[2]) == 0) {