mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
fixes for set top, masterin api
This commit is contained in:
parent
de9e83fd61
commit
7a39822813
@ -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,8 +345,9 @@ 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();
|
||||
@ -399,8 +401,9 @@ 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();
|
||||
@ -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
|
||||
|
@ -627,6 +627,7 @@ int readConfigFile() {
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -651,6 +651,7 @@ int readConfigFile() {
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -655,6 +655,7 @@ int readConfigFile() {
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -303,11 +303,11 @@ Result<bool> 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 {
|
||||
|
@ -513,6 +513,7 @@ bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
||||
|
||||
void Module::setMaster(const bool master) {
|
||||
sendToDetector(F_SET_MASTER, static_cast<int>(master), nullptr);
|
||||
sendToDetectorStop(F_SET_MASTER, static_cast<int>(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<bool>(sendToDetector<int>(F_GET_TOP)));
|
||||
return (static_cast<bool>(sendToDetector<int>(F_GET_TOP)));
|
||||
}
|
||||
|
||||
void Module::setTop(bool value) {
|
||||
sendToDetector<int>(F_SET_TOP, static_cast<int>(value));
|
||||
sendToDetector(F_SET_TOP, static_cast<int>(value), nullptr);
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
|
Loading…
x
Reference in New Issue
Block a user