forked from epics_driver_modules/motorBase
Merge pull request #105 from kmpeters/XPS_mutex_id_init
Fix for segfault when XPSConfigAxis isn't called before using a motor (Fixes #104)
This commit is contained in:
@@ -612,6 +612,10 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double
|
||||
double positions[XPS_MAX_AXES] = {0.0};
|
||||
|
||||
if (pAxis == NULL) return MOTOR_AXIS_ERROR;
|
||||
if (!pAxis->mutexId) {
|
||||
PRINT(pAxis->logParam, MOTOR_ERROR, "motorAxisSetDouble[%d,%d]: invalid mutex ID. Call XPSConfigAxis first for initialization.\n", pAxis->card, pAxis->axis);
|
||||
return MOTOR_AXIS_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (epicsMutexLock( pAxis->mutexId ) == epicsMutexLockOK)
|
||||
@@ -937,6 +941,11 @@ static int motorAxisMove(AXIS_HDL pAxis, double position, int relative,
|
||||
|
||||
if (pAxis == NULL) return MOTOR_AXIS_ERROR;
|
||||
|
||||
if (!pAxis->mutexId) {
|
||||
PRINT(pAxis->logParam, MOTOR_ERROR, "motorAxisMove[%d,%d]: invalid mutex ID. Call XPSConfigAxis first for initialization.\n", pAxis->card, pAxis->axis);
|
||||
return MOTOR_AXIS_ERROR;
|
||||
}
|
||||
|
||||
PRINT(pAxis->logParam, FLOW, "Set card %d, axis %d move to %f, min vel=%f, max_vel=%f, accel=%f\n",
|
||||
pAxis->card, pAxis->axis, position, min_velocity, max_velocity, acceleration);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user