From fc0306564c491b435e6e2c9e999041a98e78a7f9 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 28 Mar 2019 14:22:40 +0100 Subject: [PATCH] ctb server: sync is min clock and must go higher when the others do --- .../ctbDetectorServer/slsDetectorFunctionList.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index dc9fbcfcb..aab345f1d 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -1783,21 +1783,25 @@ void configureSyncFrequency(enum CLKINDEX ind) { int configure = 0; - // sync is greater than current + // find the smallest frequency + int min = (aFreq < bFreq) ? aFreq : bFreq; + min = (retval < min) ? retval : min; + + // sync is greater than min if (syncFreq > retval) { FILE_LOG(logINFO, ("\t--Configuring Sync Clock\n")); configure = 1; } - // the others are both greater than current - else if ((aFreq > retval && bFreq > retval)) { + // sync is smaller than min + else if (syncFreq < min) { FILE_LOG(logINFO, ("\t++Configuring Sync Clock\n")); configure = 1; } // configure sync to current if (configure) - configureFrequency(SYNC_CLK, retval); + configureFrequency(SYNC_CLK, min); } void setAdcOffsetRegister(int adc, int val) {