From 546bef5e5a404ed9accf09bced91f0266ec2f5fa Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 17 Jul 2020 15:38:27 +0200 Subject: [PATCH] powerchip at server startup --- .../slsDetectorFunctionList.c | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 219819826..2b9cd2f04 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -21,6 +21,7 @@ // Global variable from slsDetectorServer_funcs extern int debugflag; +extern int checkModuleFlag; extern udpStruct udpDetails; extern const enum detectorType myDetectorType; @@ -426,6 +427,40 @@ void setupDetector() { setGateDelay(i, DEFAULT_GATE_DELAY); } setInitialExtSignals(); + + // check module type attached if not in debug mode + { + int ret = checkDetectorType(); + if (checkModuleFlag) { + switch (ret) { + case -1: + sprintf(initErrorMessage, + "Could not get the module type attached.\n"); + initError = FAIL; + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + return; + case -2: + sprintf(initErrorMessage, + "No Module attached! Run server with -nomodule.\n"); + initError = FAIL; + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + return; + case FAIL: + sprintf(initErrorMessage, + "Wrong Module (Not Mythen3) attached!\n"); + initError = FAIL; + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + return; + default: + break; + } + } else { + LOG(logINFOBLUE, + ("In No-Module mode: Ignoring module type. Continuing.\n")); + } + } + + powerChip(1); loadDefaultPattern(DEFAULT_PATTERN_FILE); }