Static linking of sinqMotor into masterMacs
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "sinqMotor"]
|
||||||
|
path = sinqMotor
|
||||||
|
url = https://gitea.psi.ch/lin-epics-modules/sinqMotor
|
11
Makefile
11
Makefile
@ -12,18 +12,23 @@ REQUIRED+=sinqMotor
|
|||||||
# Specify the version of asynMotor we want to build against
|
# Specify the version of asynMotor we want to build against
|
||||||
motorBase_VERSION=7.2.2
|
motorBase_VERSION=7.2.2
|
||||||
|
|
||||||
# Specify the version of sinqMotor we want to build against
|
|
||||||
sinqMotor_VERSION=0.14.0
|
|
||||||
|
|
||||||
# These headers allow to depend on this library for derived drivers.
|
# These headers allow to depend on this library for derived drivers.
|
||||||
HEADERS += src/masterMacsAxis.h
|
HEADERS += src/masterMacsAxis.h
|
||||||
HEADERS += src/masterMacsController.h
|
HEADERS += src/masterMacsController.h
|
||||||
|
|
||||||
# Source files to build
|
# Source files to build
|
||||||
|
SOURCES += sinqMotor/src/msgPrintControl.cpp
|
||||||
|
SOURCES += sinqMotor/src/sinqAxis.cpp
|
||||||
|
SOURCES += sinqMotor/src/sinqController.cpp
|
||||||
SOURCES += src/masterMacsAxis.cpp
|
SOURCES += src/masterMacsAxis.cpp
|
||||||
SOURCES += src/masterMacsController.cpp
|
SOURCES += src/masterMacsController.cpp
|
||||||
|
|
||||||
|
# Store the record files
|
||||||
|
TEMPLATES += sinqMotor/db/asynRecord.db
|
||||||
|
TEMPLATES += sinqMotor/db/sinqMotor.db
|
||||||
|
|
||||||
# This file registers the motor-specific functions in the IOC shell.
|
# This file registers the motor-specific functions in the IOC shell.
|
||||||
|
DBDS += sinqMotor/src/sinqMotor.dbd
|
||||||
DBDS += src/masterMacs.dbd
|
DBDS += src/masterMacs.dbd
|
||||||
|
|
||||||
USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wpedantic -Wextra -Werror
|
USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result -Wpedantic -Wextra -Werror
|
||||||
|
1
sinqMotor
Submodule
1
sinqMotor
Submodule
Submodule sinqMotor added at 4d1c21fd74
@ -60,9 +60,9 @@ void appendErrorMessage(char *fullMessage, size_t capacityFullMessage,
|
|||||||
// fullMessage suffices. We need capacity for one additional character
|
// fullMessage suffices. We need capacity for one additional character
|
||||||
// because of the linebreak.
|
// because of the linebreak.
|
||||||
if (lenFullMessage + lenToBeAppended + 1 < capacityFullMessage) {
|
if (lenFullMessage + lenToBeAppended + 1 < capacityFullMessage) {
|
||||||
// Append the linebreak and readd the null terminator behind it
|
// Append the linebreak and set the null terminator behind it
|
||||||
// fullMessage[lenFullMessage] = '\n';
|
fullMessage[lenFullMessage] = '\n';
|
||||||
// fullMessage[lenFullMessage + 1] = '\0';
|
fullMessage[lenFullMessage + 1] = '\0';
|
||||||
|
|
||||||
// We check before that the capacity of fullMessage is sufficient
|
// We check before that the capacity of fullMessage is sufficient
|
||||||
strcat(fullMessage, toBeAppended);
|
strcat(fullMessage, toBeAppended);
|
||||||
@ -356,6 +356,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
|||||||
// poll. This is already part of the movement procedure.
|
// poll. This is already part of the movement procedure.
|
||||||
*moving = true;
|
*moving = true;
|
||||||
|
|
||||||
|
setAxisParamChecked(this, motorStatusMoving, *moving);
|
||||||
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status,
|
return pC_->paramLibAccessFailed(pl_status,
|
||||||
@ -919,6 +920,16 @@ asynStatus masterMacsAxis::doReset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rw_status = pC_->write(axisNo_, 85, "");
|
||||||
|
if (rw_status != asynSuccess) {
|
||||||
|
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||||
|
if (pl_status != asynSuccess) {
|
||||||
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
||||||
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rw_status;
|
return rw_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,14 @@ asynStatus masterMacsController::writeRead(int axisNo, int tcpCmd,
|
|||||||
// Log the overall status (communication successfull or not)
|
// Log the overall status (communication successfull or not)
|
||||||
if (status == asynSuccess) {
|
if (status == asynSuccess) {
|
||||||
pl_status = axis->setIntegerParam(this->motorStatusCommsError_, 0);
|
pl_status = axis->setIntegerParam(this->motorStatusCommsError_, 0);
|
||||||
|
if (pl_status != asynSuccess) {
|
||||||
|
return paramLibAccessFailed(pl_status, "motorStatusCommsError_",
|
||||||
|
axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
} else if (status == asynDisconnected) {
|
||||||
|
// Do nothing
|
||||||
} else {
|
} else {
|
||||||
|
// Set the error status bits only if the axis is not disconnected
|
||||||
|
|
||||||
// Check if the axis already is in an error communication mode. If
|
// Check if the axis already is in an error communication mode. If
|
||||||
// it is not, upstream the error. This is done to avoid "flooding"
|
// it is not, upstream the error. This is done to avoid "flooding"
|
||||||
@ -303,7 +310,6 @@ asynStatus masterMacsController::parseResponse(
|
|||||||
const char *fullCommand, const char *fullResponse, char *drvMessageText,
|
const char *fullCommand, const char *fullResponse, char *drvMessageText,
|
||||||
int *valueStart, int *valueStop, int axisNo, int tcpCmd, bool isRead) {
|
int *valueStart, int *valueStop, int axisNo, int tcpCmd, bool isRead) {
|
||||||
|
|
||||||
bool responseValid = false;
|
|
||||||
int responseStart = 0;
|
int responseStart = 0;
|
||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
int prevConnected = 0;
|
int prevConnected = 0;
|
||||||
@ -330,7 +336,6 @@ asynStatus masterMacsController::parseResponse(
|
|||||||
} else if (fullResponse[i] == '\x06') {
|
} else if (fullResponse[i] == '\x06') {
|
||||||
// ACK
|
// ACK
|
||||||
*valueStop = i;
|
*valueStop = i;
|
||||||
responseValid = true;
|
|
||||||
|
|
||||||
// Motor wasn't connected before -> Update the paramLib entry and PV
|
// Motor wasn't connected before -> Update the paramLib entry and PV
|
||||||
// to show it is now connected.
|
// to show it is now connected.
|
||||||
@ -362,7 +367,51 @@ asynStatus masterMacsController::parseResponse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
msgPrintControl_.resetCount(parseKey, pasynUserSelf);
|
||||||
|
|
||||||
|
// Check if the response matches the expectations. Each response
|
||||||
|
// contains the string "axisNo R tcpCmd" (including the spaces)
|
||||||
|
char expectedResponseSubstring[MAXBUF_] = {0};
|
||||||
|
|
||||||
|
// The response does not contain a leading 0 if tcpCmd only has
|
||||||
|
// a single digit!
|
||||||
|
if (isRead) {
|
||||||
|
snprintf(expectedResponseSubstring, MAXBUF_ - 4, "%d R %d",
|
||||||
|
axisNo, tcpCmd);
|
||||||
|
} else {
|
||||||
|
snprintf(expectedResponseSubstring, MAXBUF_ - 4, "%d S %d",
|
||||||
|
axisNo, tcpCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
msgPrintControlKey responseMatchKey = msgPrintControlKey(
|
||||||
|
portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
|
||||||
|
if (strstr(&fullResponse[responseStart],
|
||||||
|
expectedResponseSubstring) == NULL) {
|
||||||
|
adjustForPrint(printableCommand, fullCommand, MAXBUF_);
|
||||||
|
adjustForPrint(printableResponse, fullResponse, MAXBUF_);
|
||||||
|
|
||||||
|
if (msgPrintControl_.shouldBePrinted(parseKey, true,
|
||||||
|
pasynUserSelf)) {
|
||||||
|
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
|
||||||
|
"Controller \"%s\", axis %d => %s, line "
|
||||||
|
"%d:\nMismatched "
|
||||||
|
"response %s to command %s.%s\n",
|
||||||
|
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
||||||
|
printableResponse, printableCommand,
|
||||||
|
msgPrintControl_.getSuffix());
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(
|
||||||
|
drvMessageText, MAXBUF_,
|
||||||
|
"Mismatched response %s to command %s. Please call the "
|
||||||
|
"support.",
|
||||||
|
printableResponse, printableCommand);
|
||||||
|
return asynError;
|
||||||
|
} else {
|
||||||
|
msgPrintControl_.resetCount(responseMatchKey, pasynUserSelf);
|
||||||
|
}
|
||||||
|
return asynSuccess;
|
||||||
} else if (fullResponse[i] == '\x15') {
|
} else if (fullResponse[i] == '\x15') {
|
||||||
/*
|
/*
|
||||||
NAK
|
NAK
|
||||||
@ -398,7 +447,7 @@ asynStatus masterMacsController::parseResponse(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return asynDisconnected;
|
||||||
} else if (fullResponse[i] == '\x18') {
|
} else if (fullResponse[i] == '\x18') {
|
||||||
// CAN
|
// CAN
|
||||||
snprintf(drvMessageText, MAXBUF_,
|
snprintf(drvMessageText, MAXBUF_,
|
||||||
@ -415,57 +464,10 @@ asynStatus masterMacsController::parseResponse(
|
|||||||
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
||||||
printableCommand, msgPrintControl_.getSuffix());
|
printableCommand, msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
responseValid = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseValid) {
|
|
||||||
msgPrintControl_.resetCount(parseKey, pasynUserSelf);
|
|
||||||
|
|
||||||
// Check if the response matches the expectations. Each response
|
|
||||||
// contains the string "axisNo R tcpCmd" (including the spaces)
|
|
||||||
char expectedResponseSubstring[MAXBUF_] = {0};
|
|
||||||
|
|
||||||
// The response does not contain a leading 0 if tcpCmd only has
|
|
||||||
// a single digit!
|
|
||||||
if (isRead) {
|
|
||||||
snprintf(expectedResponseSubstring, MAXBUF_ - 4, "%d R %d", axisNo,
|
|
||||||
tcpCmd);
|
|
||||||
} else {
|
|
||||||
snprintf(expectedResponseSubstring, MAXBUF_ - 4, "%d S %d", axisNo,
|
|
||||||
tcpCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgPrintControlKey responseMatchKey =
|
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
if (strstr(&fullResponse[responseStart], expectedResponseSubstring) ==
|
|
||||||
NULL) {
|
|
||||||
adjustForPrint(printableCommand, fullCommand, MAXBUF_);
|
|
||||||
adjustForPrint(printableResponse, fullResponse, MAXBUF_);
|
|
||||||
|
|
||||||
if (msgPrintControl_.shouldBePrinted(parseKey, true,
|
|
||||||
pasynUserSelf)) {
|
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
|
|
||||||
"Controller \"%s\", axis %d => %s, line "
|
|
||||||
"%d:\nMismatched "
|
|
||||||
"response %s to command %s.%s\n",
|
|
||||||
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
|
||||||
printableResponse, printableCommand,
|
|
||||||
msgPrintControl_.getSuffix());
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(drvMessageText, MAXBUF_,
|
|
||||||
"Mismatched response %s to command %s. Please call the "
|
|
||||||
"support.",
|
|
||||||
printableResponse, printableCommand);
|
|
||||||
return asynError;
|
return asynError;
|
||||||
} else {
|
|
||||||
msgPrintControl_.resetCount(responseMatchKey, pasynUserSelf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return asynSuccess;
|
return asynError;
|
||||||
}
|
}
|
||||||
|
|
||||||
asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
|
asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
|
||||||
|
Reference in New Issue
Block a user