fixes for set top, masterin api

This commit is contained in:
maliakal_d 2022-03-16 12:49:22 +01:00
parent de9e83fd61
commit 7a39822813
6 changed files with 34 additions and 25 deletions

View File

@ -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,7 +345,8 @@ void initControlServer() {
}
if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
initError = FAIL;
sprintf(initErrorMessage, "Could not intitalize HV for eiger detector server: feb control serial "
sprintf(initErrorMessage, "Could not intitalize HV for eiger "
"detector server: feb control serial "
"communication\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
@ -399,7 +401,8 @@ void initStopServer() {
}
if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
initError = FAIL;
sprintf(initErrorMessage, "Could not intitalize HV for eiger detector server: feb control serial "
sprintf(initErrorMessage, "Could not intitalize HV for eiger "
"detector server: feb control serial "
"communication\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
@ -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,6 +1504,8 @@ int setMaster(enum MASTERINDEX m) {
break;
}
#else
// need to set it only once via the control server
if (isControlServer) {
if (!Beb_SetMaster(m)) {
return FAIL;
}
@ -1511,6 +1516,7 @@ int setMaster(enum MASTERINDEX m) {
return FAIL;
}
sharedMemory_unlockLocalLink();
}
// get and update master variable
if (isMaster(&master) == FAIL) {

View File

@ -627,6 +627,7 @@ int readConfigFile() {
}
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}

View File

@ -651,6 +651,7 @@ int readConfigFile() {
}
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}

View File

@ -655,6 +655,7 @@ int readConfigFile() {
}
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}

View File

@ -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 {

View File

@ -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