diff --git a/Makefile b/Makefile index 8bc550e..4fe6fca 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ ARCH_FILTER=RHEL% motorBase_VERSION=7.2.2 # These headers allow to depend on this library for derived drivers. +HEADERS += src/masterMacsIPPort.h HEADERS += src/masterMacsAxis.h HEADERS += src/masterMacsController.h @@ -17,6 +18,7 @@ HEADERS += src/masterMacsController.h SOURCES += sinqMotor/src/msgPrintControl.cpp SOURCES += sinqMotor/src/sinqAxis.cpp SOURCES += sinqMotor/src/sinqController.cpp +SOURCES += src/masterMacsAsynIPPort.c SOURCES += src/masterMacsAxis.cpp SOURCES += src/masterMacsController.cpp @@ -30,7 +32,8 @@ DBDS += sinqMotor/src/sinqMotor.dbd DBDS += src/masterMacs.dbd USR_CFLAGS += -Wall -Wextra -Wunused-result -Wextra -Werror +USR_CXXFLAGS += -Wall -Wextra -Wunused-result # These flags define the expected firmware version. See README.md, section # "Firmware version checking" for details. -USR_CXXFLAGS += -DFIRMWARE_MAJOR_VERSION=2 -DFIRMWARE_MINOR_VERSION=2 -Wall -Wextra -Weffc++ -Wunused-result -Wextra +USR_CXXFLAGS += -DFIRMWARE_MAJOR_VERSION=2 -DFIRMWARE_MINOR_VERSION=2 diff --git a/MasterMACS_manual.pdf b/MasterMACS_manual.pdf index 40bf8fc..ca660be 100644 Binary files a/MasterMACS_manual.pdf and b/MasterMACS_manual.pdf differ diff --git a/README.md b/README.md index 1e0c6af..0a63e27 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To use these scripts on Windows, prefix the Python 3 executable: C:/path/to/python3.exe C:/path/to/mastermacs_repo/utils/decodeStatus.py 1234 ``` -### Usage in IOC shell +### IOC startup script masterMacs exposes the following IOC shell functions: - `masterMacsController`: Create a new controller object. @@ -50,13 +50,17 @@ masterMacs exposes the following IOC shell functions: The full masterMacsX.cmd file looks like this: -``` +```bash # Define the name of the controller and the corresponding port epicsEnvSet("NAME","mcu") epicsEnvSet("ASYN_PORT","p$(NAME)") -# Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name -drvAsynIPPortConfigure("$(ASYN_PORT)","172.28.101.24:1025") +# Create the TCP/IP socket used to talk with the controller. The socket can be +# adressed from within the IOC shell via the port name +# We do not use the standard asyn port driver here, but a PMAC-specific one +# which enables the usage of StreamDevices for +# communicating with the controller directly. +masterMacsAsynIPPortConfigure("$(ASYN_PORT)","172.28.101.24:1025") # Create the controller object with the defined name and connect it to the socket via the port name. # The other parameters are as follows: diff --git a/db/masterMacs.db b/db/masterMacs.db index 54c016a..918bfbb 100755 --- a/db/masterMacs.db +++ b/db/masterMacs.db @@ -4,4 +4,14 @@ record(longout, "$(INSTR)$(M):NodeReset") { field(DTYP, "asynInt32") field(OUT, "@asyn($(CONTROLLER),$(AXIS),1) NODE_RESET") field(PINI, "NO") +} + +# Overrides the default value for the "Connected" record provided by sinqMotor. +record(longin, "$(INSTR)$(M):Connected") +{ + field(DTYP, "asynInt32") + field(INP, "@asyn($(CONTROLLER),$(AXIS)) MOTOR_CONNECTED") + field(SCAN, "I/O Intr") + field(PINI, "NO") + field(VAL, "0") } \ No newline at end of file diff --git a/src/masterMacsAxis.cpp b/src/masterMacsAxis.cpp index fafaa00..9242acc 100644 --- a/src/masterMacsAxis.cpp +++ b/src/masterMacsAxis.cpp @@ -215,6 +215,10 @@ asynStatus masterMacsAxis::init() { } } + // Initially assume that the axis is disconnected. It will be set to + // connected after the first communication attempted succeeded. + setAxisParamChecked(this, motorConnected, false); + // Read out the current position pl_status = pC_->read(axisNo_, 12, response); if (pl_status != asynSuccess) { @@ -329,7 +333,8 @@ asynStatus masterMacsAxis::doPoll(bool *moving) { // Does the axis need to be initialized? if (needInit()) { - // Perform the rest of the poll, but remember if sth. failed in the init. + // Perform the rest of the poll, but remember if sth. failed in the + // init. poll_status = init(); } diff --git a/src/masterMacsController.cpp b/src/masterMacsController.cpp index 5076890..da41c00 100644 --- a/src/masterMacsController.cpp +++ b/src/masterMacsController.cpp @@ -429,8 +429,6 @@ asynStatus masterMacsController::parseResponse( getAxisParamChecked(axis, motorConnected, &prevConnected); } - // We don't use strlen here since the C string terminator 0x00 - // occurs in the middle of the char array. for (uint32_t i = 0; i < MAXBUF_; i++) { if (fullResponse[i] == '\x19') { responseStart = i;