Added new system disconnect reporting to the phytron driver
This commit is contained in:
@ -139,12 +139,14 @@ PhytronAxis* PhytronController::getAxis(int axisNo)
|
|||||||
* \param[out] reply The controllers reply
|
* \param[out] reply The controllers reply
|
||||||
*/
|
*/
|
||||||
|
|
||||||
asynStatus PhytronController::transactController(char command[COMLEN], char reply[COMLEN])
|
asynStatus PhytronController::transactController(int axisNo,char command[COMLEN], char reply[COMLEN])
|
||||||
{
|
{
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
size_t in, out;
|
size_t in, out;
|
||||||
int reason;
|
int reason;
|
||||||
char myReply[COMLEN+10], myCommand[COMLEN+10], *pPtr;
|
char myReply[COMLEN+10], myCommand[COMLEN+10], *pPtr;
|
||||||
|
SINQAxis *axis = getAxis(axisNo);
|
||||||
|
|
||||||
|
|
||||||
pasynOctetSyncIO->flush(pasynUserController_);
|
pasynOctetSyncIO->flush(pasynUserController_);
|
||||||
|
|
||||||
@ -160,6 +162,9 @@ asynStatus PhytronController::transactController(char command[COMLEN], char repl
|
|||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, myCommand, strlen(myCommand),
|
status = pasynOctetSyncIO->writeRead(pasynUserController_, myCommand, strlen(myCommand),
|
||||||
myReply,sizeof(myReply), 1.,&out,&in,&reason);
|
myReply,sizeof(myReply), 1.,&out,&in,&reason);
|
||||||
if(status != asynSuccess){
|
if(status != asynSuccess){
|
||||||
|
if(axis!= NULL){
|
||||||
|
axis->updateMsgTxtFromDriver("Lost connection to motor controller");
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +246,7 @@ asynStatus PhytronAxis::move(double position, int relative, double minVelocity,
|
|||||||
}
|
}
|
||||||
homing = 0;
|
homing = 0;
|
||||||
sprintf(command, "%s%cA%f", pC_->selector,phytronChar,position/1000.);
|
sprintf(command, "%s%cA%f", pC_->selector,phytronChar,position/1000.);
|
||||||
status = pC_->transactController(command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
if(strstr(reply,"NACK") != NULL){
|
if(strstr(reply,"NACK") != NULL){
|
||||||
errlogSevPrintf(errlogMajor, "Drive command not acknowledged on %d", axisNo_);
|
errlogSevPrintf(errlogMajor, "Drive command not acknowledged on %d", axisNo_);
|
||||||
updateMsgTxtFromDriver("Drive command not acknowledged");
|
updateMsgTxtFromDriver("Drive command not acknowledged");
|
||||||
@ -263,7 +268,7 @@ asynStatus PhytronAxis::home(double minVelocity, double maxVelocity, double acce
|
|||||||
sprintf(command, "%s%cO-",pC_->selector,phytronChar);
|
sprintf(command, "%s%cO-",pC_->selector,phytronChar);
|
||||||
homing = 1;
|
homing = 1;
|
||||||
next_poll= -1;
|
next_poll= -1;
|
||||||
status = pC_->transactController(command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
if(strstr(reply,"NACK") != NULL){
|
if(strstr(reply,"NACK") != NULL){
|
||||||
errlogSevPrintf(errlogMajor, "Home command not acknowledged on %d", axisNo_);
|
errlogSevPrintf(errlogMajor, "Home command not acknowledged on %d", axisNo_);
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
@ -306,7 +311,7 @@ asynStatus PhytronAxis::stop(double acceleration )
|
|||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
|
|
||||||
sprintf(command, "%s%cSN", pC_->selector,phytronChar);
|
sprintf(command, "%s%cSN", pC_->selector,phytronChar);
|
||||||
status = pC_->transactController(command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
errlogPrintf("Sent STOP on Axis %d\n", axisNo_);
|
errlogPrintf("Sent STOP on Axis %d\n", axisNo_);
|
||||||
updateMsgTxtFromDriver("Axis interrupted");
|
updateMsgTxtFromDriver("Axis interrupted");
|
||||||
|
|
||||||
@ -320,9 +325,9 @@ asynStatus PhytronAxis::setPosition(double position)
|
|||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
|
|
||||||
sprintf(command, "%s%cP22S%f", pC_->selector,phytronChar, position/1000.);
|
sprintf(command, "%s%cP22S%f", pC_->selector,phytronChar, position/1000.);
|
||||||
status = pC_->transactController(command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
sprintf(command, "%s%cP20S%f", pC_->selector,phytronChar, position/1000.);
|
sprintf(command, "%s%cP20S%f", pC_->selector,phytronChar, position/1000.);
|
||||||
status = pC_->transactController(command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
next_poll = -1;
|
next_poll = -1;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -366,7 +371,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
|||||||
sprintf(command,"%s%cP20R",pC_->selector,phytronChar);
|
sprintf(command,"%s%cP20R",pC_->selector,phytronChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
comStatus = pC_->transactController(command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
|
|
||||||
if(strstr(reply,"NACK") != NULL){
|
if(strstr(reply,"NACK") != NULL){
|
||||||
@ -386,7 +391,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
|||||||
|
|
||||||
// Read the moving status of this motor
|
// Read the moving status of this motor
|
||||||
sprintf(command,"%s%c=H",pC_->selector,phytronChar);
|
sprintf(command,"%s%c=H",pC_->selector,phytronChar);
|
||||||
comStatus = pC_->transactController(command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
/* errlogPrintf("Axis %d, status reply %s, position %lf\n", axisNo_, reply, position); */
|
/* errlogPrintf("Axis %d, status reply %s, position %lf\n", axisNo_, reply, position); */
|
||||||
if(strstr(reply,"ACKN") != NULL){
|
if(strstr(reply,"ACKN") != NULL){
|
||||||
@ -410,7 +415,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
|||||||
check limits and errors, upper
|
check limits and errors, upper
|
||||||
*/
|
*/
|
||||||
sprintf(command,"%s%c=I+",pC_->selector,phytronChar);
|
sprintf(command,"%s%c=I+",pC_->selector,phytronChar);
|
||||||
comStatus = pC_->transactController(command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
if(strstr(reply,"ACKE") != NULL){
|
if(strstr(reply,"ACKE") != NULL){
|
||||||
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||||
@ -423,7 +428,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
|||||||
lower limit
|
lower limit
|
||||||
*/
|
*/
|
||||||
sprintf(command,"%s%c=I-",pC_->selector,phytronChar);
|
sprintf(command,"%s%c=I-",pC_->selector,phytronChar);
|
||||||
comStatus = pC_->transactController(command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
if(strstr(reply,"ACKE") != NULL){
|
if(strstr(reply,"ACKE") != NULL){
|
||||||
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||||
@ -436,7 +441,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
|||||||
error
|
error
|
||||||
*/
|
*/
|
||||||
sprintf(command,"%s%c=E",pC_->selector,phytronChar);
|
sprintf(command,"%s%c=E",pC_->selector,phytronChar);
|
||||||
comStatus = pC_->transactController(command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
if(strstr(reply,"ACKE") != NULL){
|
if(strstr(reply,"ACKE") != NULL){
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
|
@ -56,7 +56,7 @@ friend class PhytronAxis;
|
|||||||
private:
|
private:
|
||||||
asynUser *pasynUserController_;
|
asynUser *pasynUserController_;
|
||||||
|
|
||||||
asynStatus transactController(char command[COMLEN], char reply[COMLEN]);
|
asynStatus transactController(int axisNo, char command[COMLEN], char reply[COMLEN]);
|
||||||
|
|
||||||
const char *selector;
|
const char *selector;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user