From 46578d14478d2c23d96d100839c9649db69bd57d Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 25 Feb 2022 17:50:32 +0100 Subject: [PATCH] wip --- .../slsDetectorFunctionList.c | 11 ++++++----- .../slsDetectorFunctionList.c | 6 +++++- .../slsDetectorFunctionList.c | 4 ++++ .../slsDetectorServer/src/slsDetectorServer.c | 18 ++++++++++-------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index d3966cffb..cce6330a6 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -502,15 +502,15 @@ void setupDetector() { setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1); setDBITPipeline(DEFAULT_DBIT_PIPELINE); - // master for virtual - if (checkCommandLineConfiguration() == FAIL) - return; - // also sets default dac and on chip dac values if (readConfigFile() == FAIL) { return; } + // master for virtual + if (checkCommandLineConfiguration() == FAIL) + return; + if (updateModuleId() == FAIL) { return; } @@ -1972,12 +1972,13 @@ int checkDetectorType() { if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) { LOG(logINFOBLUE, ("MASTER 25um Module\n")); + master = 1; } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <= TYPE_TOLERANCE) { master = 0; LOG(logINFOBLUE, ("SLAVE 25um Module\n")); } else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) { - master = 0; + master = -1; LOG(logINFOBLUE, ("50um Module\n")); } else { LOG(logERROR, diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index 95a6c2e57..311c98cc5 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -785,8 +785,12 @@ int checkCommandLineConfiguration() { } 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 if (master) { // master default delay set, so reset delay diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index b87049cbd..e3326921a 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -404,6 +404,10 @@ void initStopServer() { initCheckDone = 1; return; } + if (readConfigFile() == FAIL) { + initCheckDone = 1; + return; + } #ifdef VIRTUAL sharedMemory_setStop(0); // temp threshold and reset event (read by stop server) diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c index 05366b5c2..cf0481e49 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c @@ -82,11 +82,11 @@ int main(int argc, char *argv[]) { "\t-u, --update : Update mode. Skips firmware checks and " "initial detector setup. \n" "\t-i, --ignore-config : " - "[Virtual][Eiger][Jungfrau][Gotthard][Gotthard2] \n" + "[Eiger][Jungfrau][Gotthard][Gotthard2] \n" "\t Ignore config file. \n" "\t-m, --master : [Eiger][Mythen3][Gotthard][Gotthard2] \n" "\t Set Master to 0 or 1. Precedence over " - "config file. \n" + "config file. Only for virtual servers except Eiger. \n" "\t-t, --top : [Eiger] Set Top to 0 or 1. Precedence " "over config file. \n" "\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; 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 if (c == -1) @@ -199,7 +200,8 @@ int main(int argc, char *argv[]) { break; 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 " "detector\n")); exit(EXIT_FAILURE); @@ -209,10 +211,10 @@ int main(int argc, char *argv[]) { LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage)); exit(EXIT_FAILURE); } - if (masterCommandLine == 0) { - LOG(logINFO, ("Detector Slave mode\n")); - } else { + if (masterCommandLine == 1) { LOG(logINFO, ("Detector Master mode\n")); + } else { + LOG(logINFO, ("Detector Slave mode\n")); } #else 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)); exit(EXIT_FAILURE); } - if (topCommandLine == 0) { + if (topCommandLine == 1) { LOG(logINFO, ("Detector Top mode\n")); } else { LOG(logINFO, ("Detector Bottom mode\n"));