Added reading step frequency/approx. velocity to polling.

This commit is contained in:
2024-06-25 14:26:02 -05:00
parent 51fceaf7d7
commit 0600cba84d

View File

@@ -342,6 +342,7 @@ asynStatus MD90Axis::poll(bool *moving)
int driveOn;
int homed;
double position;
double velocity;
asynStatus comStatus;
static const char *functionName = "MD90Axis::poll";
@@ -440,6 +441,15 @@ asynStatus MD90Axis::poll(bool *moving)
setIntegerParam(pC_->motorStatusAtHome_, (position == 0) ? 1:0); // home limit switch
setIntegerParam(pC_->motorStatusHome_, (position == 0) ? 1:0); // at home position
// Read the current motor step frequency to calculate approx. set velocity in (encoder step lengths / s)
sprintf(pC_->outString_, "GSF");
comStatus = pC_->writeReadController();
if (comStatus) goto skip;
// The response string is of the form "0: Current step frequency: 100"
sscanf(pC_->inString_, "%d: %[^:]: %d", &replyStatus, replyString, &replyValue);
velocity = replyValue * 500.0;
setDoubleParam(pC_->motorVelocity_, velocity);
// Read the current motor integral gain (range 1-1000)
sprintf(pC_->outString_, "GGN");
comStatus = pC_->writeReadController();