Removed a doubling of functionality
ipPortUser / lowLevelPortUser are already defined in the sinqMotor library
This commit is contained in:
@ -1441,9 +1441,9 @@ asynStatus turboPmacCreateAxis(const char *portName, int axis) {
|
|||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
/*
|
/*
|
||||||
We can't use asynPrint here since this macro would require us
|
We can't use asynPrint here since this macro would require us
|
||||||
to get a lowLevelPortUser_ from a pointer to an asynPortDriver.
|
to get an asynUser from a pointer to an asynPortDriver.
|
||||||
However, the given pointer is a nullptr and therefore doesn't
|
However, the given pointer is a nullptr and therefore doesn't
|
||||||
have a lowLevelPortUser_! printf is an EPICS alternative which
|
have an asynUser! printf is an EPICS alternative which
|
||||||
works w/o that, but doesn't offer the comfort provided
|
works w/o that, but doesn't offer the comfort provided
|
||||||
by the asynTrace-facility
|
by the asynTrace-facility
|
||||||
*/
|
*/
|
||||||
|
@ -49,27 +49,12 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
|
|
||||||
// Initialization of all member variables
|
// Initialization of all member variables
|
||||||
lowLevelPortUser_ = nullptr;
|
|
||||||
comTimeout_ = comTimeout;
|
comTimeout_ = comTimeout;
|
||||||
|
|
||||||
// Maximum allowed number of subsequent timeouts before the user is
|
// Maximum allowed number of subsequent timeouts before the user is
|
||||||
// informed.
|
// informed.
|
||||||
maxSubsequentTimeouts_ = 10;
|
maxSubsequentTimeouts_ = 10;
|
||||||
|
|
||||||
// =========================================================================;
|
|
||||||
|
|
||||||
/*
|
|
||||||
We try to connect to the port via the port name provided by the constructor.
|
|
||||||
If this fails, the function is terminated via exit
|
|
||||||
*/
|
|
||||||
pasynOctetSyncIO->connect(ipPortConfigName, 0, &lowLevelPortUser_, NULL);
|
|
||||||
if (status != asynSuccess || lowLevelPortUser_ == nullptr) {
|
|
||||||
errlogPrintf("Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
|
||||||
"(cannot connect to MCU controller).\nTerminating IOC",
|
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Create additional parameter library entries
|
// Create additional parameter library entries
|
||||||
|
|
||||||
@ -103,15 +88,15 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
const char *message_from_device =
|
const char *message_from_device =
|
||||||
"\006"; // Hex-code for ACK (acknowledge) -> Each message from the MCU
|
"\006"; // Hex-code for ACK (acknowledge) -> Each message from the MCU
|
||||||
// is terminated by this value
|
// is terminated by this value
|
||||||
status = pasynOctetSyncIO->setInputEos(
|
status = pasynOctetSyncIO->setInputEos(ipPortUser_, message_from_device,
|
||||||
lowLevelPortUser_, message_from_device, strlen(message_from_device));
|
strlen(message_from_device));
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
"Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
||||||
"(setting input EOS failed with %s).\nTerminating IOC",
|
"(setting input EOS failed with %s).\nTerminating IOC",
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||||
stringifyAsynStatus(status));
|
stringifyAsynStatus(status));
|
||||||
pasynOctetSyncIO->disconnect(lowLevelPortUser_);
|
pasynOctetSyncIO->disconnect(ipPortUser_);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +108,7 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
"with %s).\nTerminating IOC",
|
"with %s).\nTerminating IOC",
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||||
stringifyAsynStatus(status));
|
stringifyAsynStatus(status));
|
||||||
pasynOctetSyncIO->disconnect(lowLevelPortUser_);
|
pasynOctetSyncIO->disconnect(ipPortUser_);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,8 +239,8 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
trying to reconnect. If the problem persists, ask them to call the support
|
trying to reconnect. If the problem persists, ask them to call the support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status = pasynOctetSyncIO->write(lowLevelPortUser_, fullCommand,
|
status = pasynOctetSyncIO->write(ipPortUser_, fullCommand, fullComandLength,
|
||||||
fullComandLength, comTimeout_, &nbytesOut);
|
comTimeout_, &nbytesOut);
|
||||||
|
|
||||||
msgPrintControlKey writeKey =
|
msgPrintControlKey writeKey =
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -279,7 +264,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
||||||
timeoutCounter += 1;
|
timeoutCounter += 1;
|
||||||
|
|
||||||
status = pasynOctetSyncIO->write(lowLevelPortUser_, fullCommand,
|
status = pasynOctetSyncIO->write(ipPortUser_, fullCommand,
|
||||||
fullComandLength, comTimeout_,
|
fullComandLength, comTimeout_,
|
||||||
&nbytesOut);
|
&nbytesOut);
|
||||||
if (status != asynTimeout) {
|
if (status != asynTimeout) {
|
||||||
@ -304,8 +289,8 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the response from the MCU buffer
|
// Read the response from the MCU buffer
|
||||||
status = pasynOctetSyncIO->read(lowLevelPortUser_, response, MAXBUF_,
|
status = pasynOctetSyncIO->read(ipPortUser_, response, MAXBUF_, comTimeout_,
|
||||||
comTimeout_, &nbytesIn, &eomReason);
|
&nbytesIn, &eomReason);
|
||||||
|
|
||||||
msgPrintControlKey readKey =
|
msgPrintControlKey readKey =
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -330,9 +315,8 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
||||||
timeoutCounter += 1;
|
timeoutCounter += 1;
|
||||||
|
|
||||||
status =
|
status = pasynOctetSyncIO->read(ipPortUser_, response, MAXBUF_,
|
||||||
pasynOctetSyncIO->read(lowLevelPortUser_, response, MAXBUF_,
|
comTimeout_, &nbytesIn, &eomReason);
|
||||||
comTimeout_, &nbytesIn, &eomReason);
|
|
||||||
if (status != asynTimeout) {
|
if (status != asynTimeout) {
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line "
|
"Controller \"%s\", axis %d => %s, line "
|
||||||
|
@ -125,8 +125,6 @@ class turboPmacController : public sinqController {
|
|||||||
static const uint32_t MAXBUF_ = 200;
|
static const uint32_t MAXBUF_ = 200;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
asynUser *lowLevelPortUser_;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Timeout for the communication process in seconds
|
Timeout for the communication process in seconds
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user