This commit is contained in:
maliakal_d 2022-02-25 17:50:32 +01:00
parent 5566cfd24f
commit 46578d1447
4 changed files with 25 additions and 14 deletions

View File

@ -502,15 +502,15 @@ void setupDetector() {
setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1); setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1);
setDBITPipeline(DEFAULT_DBIT_PIPELINE); setDBITPipeline(DEFAULT_DBIT_PIPELINE);
// master for virtual
if (checkCommandLineConfiguration() == FAIL)
return;
// also sets default dac and on chip dac values // also sets default dac and on chip dac values
if (readConfigFile() == FAIL) { if (readConfigFile() == FAIL) {
return; return;
} }
// master for virtual
if (checkCommandLineConfiguration() == FAIL)
return;
if (updateModuleId() == FAIL) { if (updateModuleId() == FAIL) {
return; return;
} }
@ -1972,12 +1972,13 @@ int checkDetectorType() {
if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) { if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) {
LOG(logINFOBLUE, ("MASTER 25um Module\n")); LOG(logINFOBLUE, ("MASTER 25um Module\n"));
master = 1;
} else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <= } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <=
TYPE_TOLERANCE) { TYPE_TOLERANCE) {
master = 0; master = 0;
LOG(logINFOBLUE, ("SLAVE 25um Module\n")); LOG(logINFOBLUE, ("SLAVE 25um Module\n"));
} else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) { } else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) {
master = 0; master = -1;
LOG(logINFOBLUE, ("50um Module\n")); LOG(logINFOBLUE, ("50um Module\n"));
} else { } else {
LOG(logERROR, LOG(logERROR,

View File

@ -785,8 +785,12 @@ int checkCommandLineConfiguration() {
} }
void setMasterSlaveConfiguration() { void setMasterSlaveConfiguration() {
LOG(logINFO, ("Reading Master Slave Configuration\n")); // not the first time its being read
if (!detectorFirstServer) {
return;
}
LOG(logINFO, ("Reading Master Slave Configuration\n"));
// master configuration // master configuration
if (master) { if (master) {
// master default delay set, so reset delay // master default delay set, so reset delay

View File

@ -404,6 +404,10 @@ void initStopServer() {
initCheckDone = 1; initCheckDone = 1;
return; return;
} }
if (readConfigFile() == FAIL) {
initCheckDone = 1;
return;
}
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
// temp threshold and reset event (read by stop server) // temp threshold and reset event (read by stop server)

View File

@ -82,11 +82,11 @@ int main(int argc, char *argv[]) {
"\t-u, --update : Update mode. Skips firmware checks and " "\t-u, --update : Update mode. Skips firmware checks and "
"initial detector setup. \n" "initial detector setup. \n"
"\t-i, --ignore-config : " "\t-i, --ignore-config : "
"[Virtual][Eiger][Jungfrau][Gotthard][Gotthard2] \n" "[Eiger][Jungfrau][Gotthard][Gotthard2] \n"
"\t Ignore config file. \n" "\t Ignore config file. \n"
"\t-m, --master <master> : [Eiger][Mythen3][Gotthard][Gotthard2] \n" "\t-m, --master <master> : [Eiger][Mythen3][Gotthard][Gotthard2] \n"
"\t Set Master to 0 or 1. Precedence over " "\t Set Master to 0 or 1. Precedence over "
"config file. \n" "config file. Only for virtual servers except Eiger. \n"
"\t-t, --top <top> : [Eiger] Set Top to 0 or 1. Precedence " "\t-t, --top <top> : [Eiger] Set Top to 0 or 1. Precedence "
"over config file. \n" "over config file. \n"
"\t-s, --stopserver : Stop server. Do not use as it is created " "\t-s, --stopserver : Stop server. Do not use as it is created "
@ -116,7 +116,8 @@ int main(int argc, char *argv[]) {
int c = 0; int c = 0;
while (c != -1) { while (c != -1) {
c = getopt_long(argc, argv, "hvp:f:gduis", long_options, &option_index); c = getopt_long(argc, argv, "hvp:f:gduim:t:s", long_options,
&option_index);
// Detect the end of the options // Detect the end of the options
if (c == -1) if (c == -1)
@ -199,7 +200,8 @@ int main(int argc, char *argv[]) {
break; break;
case 'm': case 'm':
#if (defined(MYTHEN3D) || defined(GOTTHARD2D)) && !defined(VIRTUAL) #if (defined(MYTHEN3D) || defined(GOTTHARDD) || defined(GOTTHARD2D)) && \
!defined(VIRTUAL)
LOG(logERROR, ("Cannot set master via the detector server for this " LOG(logERROR, ("Cannot set master via the detector server for this "
"detector\n")); "detector\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -209,10 +211,10 @@ int main(int argc, char *argv[]) {
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage)); LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (masterCommandLine == 0) { if (masterCommandLine == 1) {
LOG(logINFO, ("Detector Slave mode\n"));
} else {
LOG(logINFO, ("Detector Master mode\n")); LOG(logINFO, ("Detector Master mode\n"));
} else {
LOG(logINFO, ("Detector Slave mode\n"));
} }
#else #else
LOG(logERROR, ("No master implemented for this detector server\n")); LOG(logERROR, ("No master implemented for this detector server\n"));
@ -226,7 +228,7 @@ int main(int argc, char *argv[]) {
LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage)); LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (topCommandLine == 0) { if (topCommandLine == 1) {
LOG(logINFO, ("Detector Top mode\n")); LOG(logINFO, ("Detector Top mode\n"));
} else { } else {
LOG(logINFO, ("Detector Bottom mode\n")); LOG(logINFO, ("Detector Bottom mode\n"));