diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index df7a8ea98..48d15c704 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -336,7 +336,8 @@ void initControlServer() { Feb_Interface_FebInterface(); if (!Feb_Control_FebControl(normal)) { initError = FAIL; - sprintf(initErrorMessage, "Could not intitalize eiger detector sever: feb control\n"); + sprintf(initErrorMessage, + "Could not intitalize eiger detector sever: feb control\n"); LOG(logERROR, (initErrorMessage)); initCheckDone = 1; sharedMemory_unlockLocalLink(); @@ -344,12 +345,13 @@ void initControlServer() { } if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) { initError = FAIL; - sprintf(initErrorMessage, "Could not intitalize HV for eiger detector server: feb control serial " - "communication\n"); + sprintf(initErrorMessage, "Could not intitalize HV for eiger " + "detector server: feb control serial " + "communication\n"); LOG(logERROR, (initErrorMessage)); initCheckDone = 1; sharedMemory_unlockLocalLink(); - return; + return; } sharedMemory_unlockLocalLink(); LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); @@ -399,12 +401,13 @@ void initStopServer() { } if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) { initError = FAIL; - sprintf(initErrorMessage, "Could not intitalize HV for eiger detector server: feb control serial " - "communication\n"); + sprintf(initErrorMessage, "Could not intitalize HV for eiger " + "detector server: feb control serial " + "communication\n"); LOG(logERROR, (initErrorMessage)); initCheckDone = 1; sharedMemory_unlockLocalLink(); - return; + return; } sharedMemory_unlockLocalLink(); LOG(logDEBUG1, ("Stop server: FEB Initialization done\n")); @@ -423,13 +426,13 @@ void initStopServer() { } void checkVirtual9MFlag() { - LOG(logINFORED, ("updating virtual\n")); #ifdef VIRTUAL #ifdef VIRTUAL_9M normal = 0; #else normal = 1; #endif + LOG(logINFOBLUE, ("%s\n", (normal ? "NORMAL" : "9M"))); #endif } @@ -464,6 +467,8 @@ int getModuleConfiguration(int *m, int *t, int *n) { return FAIL; } #endif + LOG(logDEBUG, + ("module config read: master:%d top:%d normal:%d\n", *m, *t, *n)); return OK; } @@ -473,6 +478,7 @@ int readConfigFile() { } if (ignoreConfigFileFlag) { + LOG(logWARNING, ("Ignoring Config file\n")); return OK; } @@ -638,9 +644,6 @@ void resetToHardwareSettings() { } int checkCommandLineConfiguration() { - int masterCommandLine = -1; - int topCommandLine = -1; - if (masterCommandLine != -1) { LOG(logINFO, ("Setting %s from Command Line\n", (masterCommandLine == 1 ? "Master" : "Slave"))); @@ -1501,16 +1504,19 @@ int setMaster(enum MASTERINDEX m) { break; } #else - if (!Beb_SetMaster(m)) { - return FAIL; - } + // need to set it only once via the control server + if (isControlServer) { + if (!Beb_SetMaster(m)) { + return FAIL; + } - sharedMemory_lockLocalLink(); - if (!Feb_Control_SetMaster(m)) { + sharedMemory_lockLocalLink(); + if (!Feb_Control_SetMaster(m)) { + sharedMemory_unlockLocalLink(); + return FAIL; + } sharedMemory_unlockLocalLink(); - return FAIL; } - sharedMemory_unlockLocalLink(); // get and update master variable if (isMaster(&master) == FAIL) { @@ -1543,7 +1549,7 @@ int isMaster(int *retval) { return OK; } -int setTop(enum TOPINDEX t) { +int setTop(enum TOPINDEX t) { char *top_names[] = {TOP_NAMES}; LOG(logINFOBLUE, ("Setting up as %s\n", top_names[t])); #ifdef VIRTUAL diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index f6e4a4d94..4dde80fe7 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -627,6 +627,7 @@ int readConfigFile() { } if (ignoreConfigFileFlag) { + LOG(logWARNING, ("Ignoring Config file\n")); return OK; } diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index 311c98cc5..d20db1ff0 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -651,6 +651,7 @@ int readConfigFile() { } if (ignoreConfigFileFlag) { + LOG(logWARNING, ("Ignoring Config file\n")); return OK; } diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index e3326921a..d91f8e77d 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -655,6 +655,7 @@ int readConfigFile() { } if (ignoreConfigFileFlag) { + LOG(logWARNING, ("Ignoring Config file\n")); return OK; } diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 1f653d232..0fbe78e0e 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -303,11 +303,11 @@ Result Detector::getMaster(Positions pos) const { } void Detector::setMaster(bool master, int pos) { - if (pos == -1 && size() > 1) { - throw RuntimeError("Master can be set only to a single module"); - } // multi mod, set slaves first if (master && size() > 1) { + if (pos == -1) { + throw RuntimeError("Master can be set only to a single module"); + } pimpl->Parallel(&Module::setMaster, {}, false); pimpl->Parallel(&Module::setMaster, {pos}, master); } else { diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index dc96b3cfe..1fcfdb3fb 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -513,6 +513,7 @@ bool Module::isMaster() const { return sendToDetectorStop(F_GET_MASTER); } void Module::setMaster(const bool master) { sendToDetector(F_SET_MASTER, static_cast(master), nullptr); + sendToDetectorStop(F_SET_MASTER, static_cast(master), nullptr); } bool Module::isVirtualDetectorServer() const { @@ -1680,12 +1681,11 @@ void Module::setDataStream(const portPosition port, const bool enable) { } bool Module::getTop() const { - return ( - !static_cast(sendToDetector(F_GET_TOP))); + return (static_cast(sendToDetector(F_GET_TOP))); } void Module::setTop(bool value) { - sendToDetector(F_SET_TOP, static_cast(value)); + sendToDetector(F_SET_TOP, static_cast(value), nullptr); } // Jungfrau Specific