diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 02cf88664..ded41f7e6 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index 079a8fc1d..3fdecebdf 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -1296,59 +1296,59 @@ int isDACValid(enum DACINDEX ind, int val, int mV, char *mess) { return FAIL; } } - // validate max value - if (val != LTC2620_GetPowerDownValue()) { - if (!mV) { - // dacs and power regs - if (val > LTC2620_GetMaxInput()) { - sprintf( - mess, - "Could not set DAC %d. Input %d exceeds max dac value %d\n", - (int)ind, val, LTC2620_GetMaxInput()); - LOG(logERROR, (mess)) - return FAIL; - } - // check vLimit - only dacs, convert to mV - if (vLimit > 0 && ind < NDAC_ONLY) { - int dacmV = 0; - if (LTC2620_DacToVoltage(val, &dacmV) == FAIL) { - sprintf(mess, - "Could not set DAC %d. Could not convert input %d " - "to mV\n", - ind, val); - LOG(logERROR, (mess)); - return FAIL; - } - if (dacmV > vLimit) { - sprintf(mess, - "Could not set DAC %d. Input %d (%d mV) exceeds " - "vLimit value %d\n", - ind, val, dacmV, vLimit); - LOG(logERROR, (mess)); - return FAIL; - } - } + if (val == LTC2620_GetPowerDownValue()) + return OK; + // validate max value/ vlimit + + // only dacs here in mV + if (mV) { + if (val > DAC_MAX_MV) { + sprintf(mess, + "Could not set DAC %d. Input %d mV exceeds max dac " + "value %d mV\n", + ind, val, DAC_MAX_MV); + LOG(logERROR, (mess)) + return FAIL; } - // only dacs in mV here - else { - if (val > DAC_MAX_MV) { - sprintf(mess, - "Could not set DAC %d. Input %d mV exceeds max dac " - "value %d mV\n", - ind, val, DAC_MAX_MV); - LOG(logERROR, (mess)) - return FAIL; - } - if (vLimit > 0 && val > vLimit) { - sprintf( - mess, + if (vLimit > 0 && val > vLimit) { + sprintf(mess, "Could not set DAC %d. Input %d mV exceeds vLimit %d mV\n", (int)ind, val, vLimit); - LOG(logERROR, (mess)) - return FAIL; - } + LOG(logERROR, (mess)) + return FAIL; + } + return OK; + } + + // dacs and power regs + if (val > LTC2620_GetMaxInput()) { + sprintf(mess, + "Could not set DAC %d. Input %d exceeds max dac value %d\n", + (int)ind, val, LTC2620_GetMaxInput()); + LOG(logERROR, (mess)) + return FAIL; + } + // vlimit check for only dacs, convert to mV (power regs checked before) + if (vLimit > 0 && ind < NDAC_ONLY) { + int dacmV = 0; + if (LTC2620_DacToVoltage(val, &dacmV) == FAIL) { + sprintf(mess, + "Could not set DAC %d. Could not convert input %d " + "to mV\n", + ind, val); + LOG(logERROR, (mess)); + return FAIL; + } + if (dacmV > vLimit) { + sprintf(mess, + "Could not set DAC %d. Input %d (%d mV) exceeds " + "vLimit value %d\n", + ind, val, dacmV, vLimit); + LOG(logERROR, (mess)); + return FAIL; } } + return OK; } diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 4e71a1a9c..61f1b46a4 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 1282bf731..25be35206 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer index 9f2671f51..ba893c1c6 100755 Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 96860a466..9004b853f 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -1200,59 +1200,59 @@ int isDACValid(enum DACINDEX ind, int val, int mV, char *mess) { return FAIL; } } - // validate max value - if (val != LTC2620_D_GetPowerDownValue()) { - if (!mV) { - // dacs and power regs - if (val > LTC2620_D_GetMaxInput()) { - sprintf( - mess, - "Could not set DAC %d. Input %d exceeds max dac value %d\n", - ind, val, LTC2620_D_GetMaxInput()); - LOG(logERROR, (mess)) - return FAIL; - } - // check vLimit - only dacs, convert to mV - if (vLimit > 0 && ind < NDAC_ONLY) { - int dacmV = 0; - if (LTC2620_D_DacToVoltage(val, &dacmV) == FAIL) { - sprintf(mess, - "Could not set DAC %d. Could not convert input %d " - "to mV\n", - (int)ind, val); - LOG(logERROR, (mess)); - return FAIL; - } - if (dacmV > vLimit) { - sprintf(mess, - "Could not set DAC %d. Input %d (%d mV) exceeds " - "vLimit value %d\n", - ind, val, dacmV, vLimit); - LOG(logERROR, (mess)); - return FAIL; - } - } + if (val == LTC2620_D_GetPowerDownValue()) + return OK; + // validate max value/ vlimit + + // only dacs here in mV + if (mV) { + if (val > DAC_MAX_MV) { + sprintf(mess, + "Could not set DAC %d. Input %d mV exceeds max dac " + "value %d mV\n", + (int)ind, val, DAC_MAX_MV); + LOG(logERROR, (mess)) + return FAIL; } - // only dacs in mV here - else { - if (val > DAC_MAX_MV) { - sprintf(mess, - "Could not set DAC %d. Input %d mV exceeds max dac " - "value %d mV\n", - (int)ind, val, DAC_MAX_MV); - LOG(logERROR, (mess)) - return FAIL; - } - if (vLimit > 0 && val > vLimit) { - sprintf( - mess, + if (vLimit > 0 && val > vLimit) { + sprintf(mess, "Could not set DAC %d. Input %d mV exceeds vLimit %d mV\n", ind, val, vLimit); - LOG(logERROR, (mess)) - return FAIL; - } + LOG(logERROR, (mess)) + return FAIL; + } + return OK; + } + + // dacs and power regs + if (val > LTC2620_D_GetMaxInput()) { + sprintf(mess, + "Could not set DAC %d. Input %d exceeds max dac value %d\n", + ind, val, LTC2620_D_GetMaxInput()); + LOG(logERROR, (mess)) + return FAIL; + } + // vlimit check for only dacs, convert to mV (power regs checked before) + if (vLimit > 0 && ind < NDAC_ONLY) { + int dacmV = 0; + if (LTC2620_D_DacToVoltage(val, &dacmV) == FAIL) { + sprintf(mess, + "Could not set DAC %d. Could not convert input %d " + "to mV\n", + (int)ind, val); + LOG(logERROR, (mess)); + return FAIL; + } + if (dacmV > vLimit) { + sprintf(mess, + "Could not set DAC %d. Input %d (%d mV) exceeds " + "vLimit value %d\n", + ind, val, dacmV, vLimit); + LOG(logERROR, (mess)); + return FAIL; } } + return OK; }