Reverted some of the changes to SMChydraDriver.cpp from r15724 (simulating direction bit and setting motorStatusCommsError).

This commit is contained in:
kmpeters
2012-12-21 19:25:56 +00:00
parent 3b4a24ea82
commit 9df1baeb5c
+3 -10
View File
@@ -343,14 +343,12 @@ asynStatus SMChydraAxis::poll(bool *moving)
{
int done;
int driveOn;
int direction;
int lowLimit;
int highLimit;
int ignoreLowLimit;
int ignoreHighLimit;
int axisStatus=-1;
double position=0.0;
double newposition;
asynStatus comStatus;
static const char *functionName = "SMChydraAxis::poll";
@@ -361,14 +359,9 @@ asynStatus SMChydraAxis::poll(bool *moving)
if (comStatus) goto skip;
// The response string is a double
position = atof( (char *) &pC_->inString_);
newposition = position / axisRes_;
// Simulate the direction bit
direction = (newposition >= pC_->motorPosition_) ? 1 : 0;
setIntegerParam(pC_->motorStatusDirection_, direction);
// Update position, now that is is no longer needed for direction calc
setDoubleParam(pC_->motorPosition_, (position / axisRes_) );
setDoubleParam(pC_->motorEncoderPosition_, (position / axisRes_) );
// Read the status of this motor
sprintf(pC_->outString_, "%i nst", (axisNo_ + 1));
comStatus = pC_->writeReadController();
@@ -463,10 +456,10 @@ asynStatus SMChydraAxis::poll(bool *moving)
// Check the drive power bit (0x100)
driveOn = (axisStatus & 0x100) ? 0 : 1;
setIntegerParam(pC_->motorStatusPowerOn_, driveOn);
setIntegerParam(pC_->motorStatusCommsError_, 0);
setIntegerParam(pC_->motorStatusProblem_, 0);
skip:
setIntegerParam(pC_->motorStatusCommsError_, comStatus ? 1:0);
setIntegerParam(pC_->motorStatusProblem_, comStatus ? 1:0);
callParamCallbacks();
return comStatus ? asynError : asynSuccess;
}