Updated to read md90 position.

This commit is contained in:
2024-05-23 14:05:25 -05:00
parent a43acb8537
commit 07f07d16ad

View File

@@ -260,6 +260,9 @@ asynStatus MD90Axis::setClosedLoop(bool closedLoop)
* \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */ * \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */
asynStatus MD90Axis::poll(bool *moving) asynStatus MD90Axis::poll(bool *moving)
{ {
int replyStatus;
char replyString[256];
double replyValue;
int done; int done;
int driveOn; int driveOn;
int limit; int limit;
@@ -267,11 +270,12 @@ asynStatus MD90Axis::poll(bool *moving)
asynStatus comStatus; asynStatus comStatus;
// Read the current motor position // Read the current motor position
sprintf(pC_->outString_, "#%02dP", axisNo_); sprintf(pC_->outString_, "GEE");
comStatus = pC_->writeReadController(); comStatus = pC_->writeReadController();
if (comStatus) goto skip; if (comStatus) goto skip;
// The response string is of the form "#01P=+1000" // The response string is of the form "0: Current position in nanometers: 1000"
position = atof(&pC_->inString_[5]); sscanf (pC_->inString_, "%d: %[^:]: %lf", &replyStatus, replyString, &replyValue);
position = replyValue;
setDoubleParam(pC_->motorPosition_, position); setDoubleParam(pC_->motorPosition_, position);
// Read the moving status of this motor // Read the moving status of this motor