Added MsgTxt support to pmac controller driver

This commit is contained in:
2019-01-08 11:47:02 +01:00
parent 972131d86a
commit 02ab5ff9b8
4 changed files with 58 additions and 28 deletions

View File

@@ -13,6 +13,11 @@
* This affects also the commands they understand.
*
* Mark Koennecke, February 2013
*
* Updated to use the MsgTxt field for error messages as
* used at ESS and SINQ
*
* Mark Koennecke, January 2019
********************************************/
@@ -38,6 +43,7 @@ using std::endl;
#include "asynOctetSyncIO.h"
#include "pmacController.h"
#include "pmacAxis.h"
#define MULT 1000.
@@ -132,12 +138,7 @@ extern "C" {
pmacController::pmacController(const char *portName, const char *lowLevelPortName, int lowLevelPortAddress,
int numAxes, double movingPollPeriod, double idlePollPeriod)
: asynMotorController(portName, numAxes+1, NUM_MOTOR_DRIVER_PARAMS,
0, // No additional interfaces
0, // No addition interrupt interfaces
ASYN_CANBLOCK | ASYN_MULTIDEVICE,
1, // autoconnect
0, 0) // Default priority and stack size
: SINQController(portName, lowLevelPortName, numAxes+1)
{
static const char *functionName = "pmacController::pmacController";
@@ -251,7 +252,7 @@ asynStatus pmacController::printConnectedStatus()
* @param command - String command to send.
* @response response - String response back.
*/
asynStatus pmacController::lowLevelWriteRead(const char *command, char *response)
asynStatus pmacController::lowLevelWriteRead(int axisNo, const char *command, char *response)
{
asynStatus status = asynSuccess;
@@ -260,6 +261,7 @@ asynStatus pmacController::lowLevelWriteRead(const char *command, char *response
size_t nread = 0;
int commsError = 0;
static const char *functionName = "pmacController::lowLevelWriteRead";
pmacAxis *axis = getAxis(axisNo);
debugFlow(functionName);
@@ -286,6 +288,9 @@ asynStatus pmacController::lowLevelWriteRead(const char *command, char *response
if (status) {
asynPrint(lowLevelPortUser_, ASYN_TRACE_ERROR, "%s: Error from pasynOctetSyncIO->writeRead. command: %s\n", functionName, command);
setIntegerParam(this->motorStatusCommsError_, 1);
if(axis!= NULL){
axis->updateMsgTxtFromDriver("Lost connection to motor controller");
}
} else {
setIntegerParam(this->motorStatusCommsError_, 0);
}
@@ -422,7 +427,7 @@ asynStatus pmacController::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
//Execute the command.
if (command[0] != 0 && status == asynSuccess) {
status = lowLevelWriteRead(command, response);
status = lowLevelWriteRead(pAxis->axisNo_,command, response);
}
//Call base class method