forked from epics_driver_modules/motorBase
Replace stepSize
This commit is contained in:
@@ -59,6 +59,7 @@ in file LICENSE that is included with this distribution.
|
||||
* .13 12-15-11 rls - Bug fix for jog not terminating; must check both
|
||||
* PLANESTATUS and AXISSTATUS for move_active.
|
||||
* .14 12-22-11 rls - Restore home search; using HomeAsync.abx vendor program.
|
||||
* .15 02-02-12 rls - Replace "stepSize > 0.0" test with ReverseDirec parameter.
|
||||
*/
|
||||
|
||||
|
||||
@@ -146,6 +147,7 @@ typedef struct motorAxisHandle
|
||||
epicsMutexId mutexId;
|
||||
Switch_Level swconfig;
|
||||
int lastFault;
|
||||
bool ReverseDirec;
|
||||
} motorAxis;
|
||||
|
||||
typedef struct
|
||||
@@ -715,15 +717,16 @@ static void EnsemblePoller(EnsembleController *pController)
|
||||
|
||||
motorParam->setInteger(pAxis->params, motorAxisPowerOn, axisStatus.Bits.axis_enabled);
|
||||
motorParam->setInteger(pAxis->params, motorAxisHomeSignal, axisStatus.Bits.home_limit);
|
||||
if (pAxis->stepSize > 0.0)
|
||||
|
||||
if (pAxis->ReverseDirec == true)
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, axisStatus.Bits.motion_ccw);
|
||||
else
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, !axisStatus.Bits.motion_ccw);
|
||||
|
||||
CW_sw_active = !(axisStatus.Bits.CW_limit ^ pAxis->swconfig.Bits.CWEOTSWstate);
|
||||
CCW_sw_active = !(axisStatus.Bits.CCW_limit ^ pAxis->swconfig.Bits.CCWEOTSWstate);
|
||||
|
||||
if (!((pAxis->stepSize > 0.0) ^ (pAxis->swconfig.Bits.EOTswitch)))
|
||||
|
||||
if (pAxis->ReverseDirec == false)
|
||||
{
|
||||
motorParam->setInteger(pAxis->params, motorAxisHighHardLimit, CW_sw_active);
|
||||
motorParam->setInteger(pAxis->params, motorAxisLowHardLimit, CCW_sw_active);
|
||||
@@ -845,6 +848,7 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
int axis, status, digits, retry = 0;
|
||||
char inputBuff[BUFFER_SIZE], outputBuff[BUFFER_SIZE];
|
||||
int numAxesFound;
|
||||
static char getparamstr[] = "GETPARM(@%d, %d)";
|
||||
|
||||
if (numEnsembleControllers < 1)
|
||||
{
|
||||
@@ -903,7 +907,7 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
for (axis = 0; axis < ENSEMBLE_MAX_AXES && numAxesFound < numAxes; axis++)
|
||||
{
|
||||
/* Does this axis actually exist? */
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_AxisName);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_AxisName);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
|
||||
/* We know the axis exists if we got an ACK response */
|
||||
@@ -916,7 +920,7 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
pAxis->mutexId = epicsMutexMustCreate();
|
||||
pAxis->params = motorParam->create(0, MOTOR_AXIS_NUM_PARAMS);
|
||||
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_PositionFeedbackType);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_PositionFeedbackType);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR && atoi(&inputBuff[1]) > 0)
|
||||
{
|
||||
@@ -924,7 +928,7 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
motorParam->setInteger(pAxis->params, motorAxisHasEncoder, 1);
|
||||
}
|
||||
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_CountsPerUnit);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_CountsPerUnit);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR)
|
||||
pAxis->stepSize = 1 / atof(&inputBuff[1]);
|
||||
@@ -935,18 +939,18 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
digits = 1;
|
||||
pAxis->maxDigits = digits;
|
||||
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_HomeOffset);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_HomeOffset);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR)
|
||||
pAxis->homePreset = atof(&inputBuff[1]);
|
||||
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_HomeSetup);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_HomeSetup);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR)
|
||||
pAxis->homeDirection = atoi(&inputBuff[1]);
|
||||
numAxesFound++;
|
||||
|
||||
sprintf(outputBuff, "GETPARM(@%d, %d)", axis, PARAMETERID_EndOfTravelLimitSetup);
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_EndOfTravelLimitSetup);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR)
|
||||
pAxis->swconfig.All = atoi(&inputBuff[1]);
|
||||
@@ -957,6 +961,12 @@ int EnsembleAsynConfig(int card, /* Controller number */
|
||||
/* Set RAMP MODE to RATE. */
|
||||
sprintf(outputBuff, "RAMP MODE @%d RATE", axis);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
|
||||
/* Get Reverse Direction indicator. */
|
||||
sprintf(outputBuff, getparamstr, axis, PARAMETERID_ReverseMotionDirection);
|
||||
sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (inputBuff[0] == ASCII_ACK_CHAR)
|
||||
pAxis->ReverseDirec = (bool) atoi(&inputBuff[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user