From 01d1c86403676a70c1c5b9450bdb78da44be0253 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 8 May 2020 11:03:00 +0200 Subject: [PATCH] mythen3 trim one chip fix --- .../mythen3DetectorServer/slsDetectorFunctionList.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index faa5abdcb..bb23f1d27 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -591,7 +591,7 @@ int setTrimbits(int *trimbits) { LOG(logINFOBLUE, ("Setting trimbits\n")); // validate - for (int ichan = 0; ichan < NCHAN; ++ichan) { + for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) { if (trimbits[ichan] < 0 || trimbits[ichan] > 63) { LOG(logERROR, ("Trimbit value (%d) for channel %d is invalid\n", trimbits[ichan], ichan)); @@ -720,7 +720,7 @@ int setTrimbits(int *trimbits) { } // copy trimbits locally - for (int ichan = 0; ichan < NCHAN; ++ichan) { + for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) { detectorChans[ichan] = trimbits[ichan]; } trimmingPrint = logINFO; @@ -728,8 +728,8 @@ int setTrimbits(int *trimbits) { } int setAllTrimbits(int val) { - int *trimbits = malloc(sizeof(int) * NCHAN); - for (int ichan = 0; ichan < NCHAN; ++ichan) { + int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan)); + for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) { trimbits[ichan] = val; } if (setTrimbits(trimbits) == FAIL) { @@ -748,7 +748,7 @@ int setAllTrimbits(int val) { int getAllTrimbits() { int value = detectorChans[0]; if (detectorModules) { - for (int ichan = 0; ichan < NCHAN; ichan++) { + for (int ichan = 0; ichan < ((detectorModules)->nchan); ichan++) { if (detectorChans[ichan] != value) { value = -1; break;