Compare commits

...

1 Commits
0.4.0 ... 0.2.1

Author SHA1 Message Date
3b648c4f7b Improved the error message when the MCU response is printed and the IOC
shell constructor documentation.
2024-11-27 15:57:00 +01:00

View File

@ -1,9 +1,10 @@
// Needed to use strcpy_s from string.h
#define __STDC_WANT_LIB_EXT1__ 1
#include "pmacv3Controller.h"
#include "asynMotorController.h"
#include "asynOctetSyncIO.h"
#include "pmacv3Axis.h"
#include <cstring>
#include <epicsExport.h>
#include <errlog.h>
#include <iocsh.h>
@ -19,12 +20,15 @@
* @param src Original string
*/
void adjustResponseForPrint(char *dst, const char *src) {
strcpy(dst, src);
// Needed to use strcpy_s from string.h
#ifdef __STDC_LIB_EXT1__
strcpy_s(dst, src);
for (size_t i = 0; i < strlen(dst); i++) {
if (dst[i] == '\r') {
dst[i] = '_';
}
}
#endif
}
/**
@ -325,7 +329,6 @@ asynStatus pmacv3Controller::writeRead(int axisNo, const char *command,
if (numExpectedResponses != numReceivedResponses) {
adjustResponseForPrint(modResponse, response);
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s => line %d:\nUnexpected response %s (_ are "
"carriage returns) for command %s\n",
@ -566,9 +569,9 @@ types and then providing "factory" functions
(configCreateControllerCallFunc). These factory functions are used to
register the constructors during compilation.
*/
static const iocshArg CreateControllerArg0 = {"Controller port name",
static const iocshArg CreateControllerArg0 = {"Controller name (e.g. mcu1)",
iocshArgString};
static const iocshArg CreateControllerArg1 = {"Low level port name",
static const iocshArg CreateControllerArg1 = {"Asyn IP port name (e.g. pmcu1)",
iocshArgString};
static const iocshArg CreateControllerArg2 = {"Number of axes", iocshArgInt};
static const iocshArg CreateControllerArg3 = {"Moving poll rate (s)",
@ -591,7 +594,8 @@ static void configPmacV3CreateControllerCallFunc(const iocshArgBuf *args) {
Same procedure as for the CreateController function, but for the axis
itself.
*/
static const iocshArg CreateAxisArg0 = {"Controller port name", iocshArgString};
static const iocshArg CreateAxisArg0 = {"Controller name (e.g. mcu1)",
iocshArgString};
static const iocshArg CreateAxisArg1 = {"Axis number", iocshArgInt};
static const iocshArg *const CreateAxisArgs[] = {&CreateAxisArg0,
&CreateAxisArg1};