From a39a033940042df3c589b344617c3b104acabd11 Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Tue, 4 Dec 2018 17:04:06 -0600 Subject: [PATCH 1/5] Add cameraID to constructor to select which camera in a multiple camera system --- andorApp/src/andorCCD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/andorApp/src/andorCCD.h b/andorApp/src/andorCCD.h index 1603fb5..f56e123 100755 --- a/andorApp/src/andorCCD.h +++ b/andorApp/src/andorCCD.h @@ -79,7 +79,7 @@ typedef struct { */ class AndorCCD : public ADDriver { public: - AndorCCD(const char *portName, const char *installPath, int shamrockID, + AndorCCD(const char *portName, const char *installPath, int cameraID, int shamrockID, int maxBuffers, size_t maxMemory, int priority, int stackSize); virtual ~AndorCCD(); From a0787d23c2c1be67b27da93a1387c4928866714f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Tue, 4 Dec 2018 17:04:19 -0600 Subject: [PATCH 2/5] Add cameraID to constructor to select which camera in a multiple camera system; select camera --- andorApp/src/andorCCD.cpp | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/andorApp/src/andorCCD.cpp b/andorApp/src/andorCCD.cpp index a27aa05..83e842f 100755 --- a/andorApp/src/andorCCD.cpp +++ b/andorApp/src/andorCCD.cpp @@ -101,6 +101,8 @@ static void exitHandler(void *drvPvt); * \param[in] installPath The path to the Andor directory containing the detector INI files, etc. * This can be specified as an empty string ("") for new detectors that don't use the INI * files on Windows, but must be a valid path on Linux. + * \param[in] cameraID The index number of the desired camera. + * 0 is the first camera in the system. * \param[in] shamrockID The index number of the Shamrock spectrograph, if installed. * 0 is the first Shamrock in the system. Ignored if there are no Shamrocks. * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is @@ -110,7 +112,7 @@ static void exitHandler(void *drvPvt); * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. */ -AndorCCD::AndorCCD(const char *portName, const char *installPath, int shamrockID, +AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraID, int shamrockID, int maxBuffers, size_t maxMemory, int priority, int stackSize) : ADDriver(portName, 1, NUM_ANDOR_DET_PARAMS, maxBuffers, maxMemory, @@ -191,6 +193,17 @@ AndorCCD::AndorCCD(const char *portName, const char *installPath, int shamrockID // Initialize camera try { + epicsInt32 numCameras; + checkStatus(GetAvailableCameras(&numCameras)); + if (cameraID < numCameras) { + epicsInt32 cameraHandle; + checkStatus(GetCameraHandle(cameraID, &cameraHandle)); + checkStatus(SetCurrentCamera(cameraHandle)); + } else { + asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, + "%s::%s error selecting camera %d, only %d cameras in system\n", + driverName, functionName, cameraID, numCameras); + } printf("%s:%s: initializing camera\n", driverName, functionName); checkStatus(Initialize(mInstallPath)); @@ -1841,11 +1854,11 @@ static void andorDataTaskC(void *drvPvt) * \param[in] stackSize The stack size for the asyn port driver thread */ extern "C" { -int andorCCDConfig(const char *portName, const char *installPath, int shamrockID, +int andorCCDConfig(const char *portName, const char *installPath, int cameraID, int shamrockID, int maxBuffers, size_t maxMemory, int priority, int stackSize) { /*Instantiate class.*/ - new AndorCCD(portName, installPath, shamrockID, maxBuffers, maxMemory, priority, stackSize); + new AndorCCD(portName, installPath, cameraID, shamrockID, maxBuffers, maxMemory, priority, stackSize); return(asynSuccess); } @@ -1855,24 +1868,26 @@ int andorCCDConfig(const char *portName, const char *installPath, int shamrockID /* andorCCDConfig */ static const iocshArg andorCCDConfigArg0 = {"Port name", iocshArgString}; static const iocshArg andorCCDConfigArg1 = {"installPath", iocshArgString}; -static const iocshArg andorCCDConfigArg2 = {"shamrockID", iocshArgInt}; -static const iocshArg andorCCDConfigArg3 = {"maxBuffers", iocshArgInt}; -static const iocshArg andorCCDConfigArg4 = {"maxMemory", iocshArgInt}; -static const iocshArg andorCCDConfigArg5 = {"priority", iocshArgInt}; -static const iocshArg andorCCDConfigArg6 = {"stackSize", iocshArgInt}; +static const iocshArg andorCCDConfigArg2 = {"cameraID", iocshArgInt}; +static const iocshArg andorCCDConfigArg3 = {"shamrockID", iocshArgInt}; +static const iocshArg andorCCDConfigArg4 = {"maxBuffers", iocshArgInt}; +static const iocshArg andorCCDConfigArg5 = {"maxMemory", iocshArgInt}; +static const iocshArg andorCCDConfigArg6 = {"priority", iocshArgInt}; +static const iocshArg andorCCDConfigArg7 = {"stackSize", iocshArgInt}; static const iocshArg * const andorCCDConfigArgs[] = {&andorCCDConfigArg0, &andorCCDConfigArg1, &andorCCDConfigArg2, &andorCCDConfigArg3, &andorCCDConfigArg4, &andorCCDConfigArg5, - &andorCCDConfigArg6}; + &andorCCDConfigArg6, + &andorCCDConfigArg7}; static const iocshFuncDef configAndorCCD = {"andorCCDConfig", 7, andorCCDConfigArgs}; static void configAndorCCDCallFunc(const iocshArgBuf *args) { andorCCDConfig(args[0].sval, args[1].sval, args[2].ival, args[3].ival, - args[4].ival, args[5].ival, args[6].ival); + args[4].ival, args[5].ival, args[6].ival, args[7].ival); } static void andorCCDRegister(void) From 58080386396d2059442af68678797a6b16b8035f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Wed, 5 Dec 2018 09:47:31 -0600 Subject: [PATCH 3/5] Added cameraID to andorCCDConfig --- iocs/andorIOC/iocBoot/iocAndor/st.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iocs/andorIOC/iocBoot/iocAndor/st.cmd b/iocs/andorIOC/iocBoot/iocAndor/st.cmd index 89a37bf..6a70291 100755 --- a/iocs/andorIOC/iocBoot/iocAndor/st.cmd +++ b/iocs/andorIOC/iocBoot/iocAndor/st.cmd @@ -15,9 +15,9 @@ epicsEnvSet("CBUFFS", "500") # The search path for database files epicsEnvSet("EPICS_DB_INCLUDE_PATH", "$(ADCORE)/db") -# andorCCDConfig(const char *portName, const char *installPath, int shamrockID, +# andorCCDConfig(const char *portName, const char *installPath, int cameraID, int shamrockID, # int maxBuffers, size_t maxMemory, int priority, int stackSize) -#andorCCDConfig("$(PORT)", "/usr/local/etc/andor/", 0, 0, 0, 0 ,0) +#andorCCDConfig("$(PORT)", "/usr/local/etc/andor/", 0, 0, 0, 0, 0 ,0) andorCCDConfig("$(PORT)", "", 0, 0, 0, 0, 0) dbLoadRecords("$(ADANDOR)/db/andorCCD.template", "P=$(PREFIX),R=cam1:,PORT=$(PORT),ADDR=0,TIMEOUT=1") From 7641988b51bce42cfc7e2b2b0218a1afc28a9650 Mon Sep 17 00:00:00 2001 From: Hinko Kocevar Date: Tue, 18 Dec 2018 15:23:38 +0100 Subject: [PATCH 4/5] use device serial number to select the camera (0 for any camera) --- andorApp/src/andorCCD.cpp | 51 ++++++++++++++++++--------- andorApp/src/andorCCD.h | 2 +- iocs/andorIOC/iocBoot/iocAndor/st.cmd | 7 ++-- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/andorApp/src/andorCCD.cpp b/andorApp/src/andorCCD.cpp index 83e842f..adb5b13 100755 --- a/andorApp/src/andorCCD.cpp +++ b/andorApp/src/andorCCD.cpp @@ -101,8 +101,7 @@ static void exitHandler(void *drvPvt); * \param[in] installPath The path to the Andor directory containing the detector INI files, etc. * This can be specified as an empty string ("") for new detectors that don't use the INI * files on Windows, but must be a valid path on Linux. - * \param[in] cameraID The index number of the desired camera. - * 0 is the first camera in the system. + * \param[in] cameraSerial The serial number of the desired camera. * \param[in] shamrockID The index number of the Shamrock spectrograph, if installed. * 0 is the first Shamrock in the system. Ignored if there are no Shamrocks. * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is @@ -112,7 +111,7 @@ static void exitHandler(void *drvPvt); * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. */ -AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraID, int shamrockID, +AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraSerial, int shamrockID, int maxBuffers, size_t maxMemory, int priority, int stackSize) : ADDriver(portName, 1, NUM_ANDOR_DET_PARAMS, maxBuffers, maxMemory, @@ -195,18 +194,37 @@ AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraID, try { epicsInt32 numCameras; checkStatus(GetAvailableCameras(&numCameras)); - if (cameraID < numCameras) { - epicsInt32 cameraHandle; - checkStatus(GetCameraHandle(cameraID, &cameraHandle)); + bool cameraFound = false; + for (i=0; i Date: Wed, 19 Dec 2018 17:57:28 -0600 Subject: [PATCH 5/5] Change from epicsInt32 to at_32 to compile on 64-bit Windows --- andorApp/src/andorCCD.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/andorApp/src/andorCCD.cpp b/andorApp/src/andorCCD.cpp index adb5b13..14618eb 100755 --- a/andorApp/src/andorCCD.cpp +++ b/andorApp/src/andorCCD.cpp @@ -192,11 +192,11 @@ AndorCCD::AndorCCD(const char *portName, const char *installPath, int cameraSeri // Initialize camera try { - epicsInt32 numCameras; + at_32 numCameras; checkStatus(GetAvailableCameras(&numCameras)); bool cameraFound = false; for (i=0; i