jungfrau server: added deg and maxadcphaseshift, ctb & moench server: set adc phase like jungfrau that positive shift is positive, moved conversion between shift to degrees to the common function. receiver: removed unused variables

This commit is contained in:
2019-03-28 09:35:53 +01:00
parent 5a4122ae7c
commit c38bebd615
14 changed files with 152 additions and 132 deletions

View File

@ -1,9 +1,9 @@
Path: slsDetectorPackage/slsDetectorServers/moenchDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 7cd5bc8b2db6e89fbec4c06c65e683cf788338c0
Revision: 22
Branch: jungfrau
Repsitory UUID: 5a4122ae7c8dae1572e9db336de70183956e58c7
Revision: 26
Branch: refactor
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4474
Last Changed Date: 2019-03-26 15:01:04.000000002 +0100 ./slsDetectorServer_defs.h
Last Changed Rev: 4481
Last Changed Date: 2019-03-28 09:08:53.000000002 +0100 ./slsDetectorFunctionList.c

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "7cd5bc8b2db6e89fbec4c06c65e683cf788338c0"
#define GITREPUUID "5a4122ae7c8dae1572e9db336de70183956e58c7"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4474
#define GITDATE 0x20190326
#define GITBRANCH "jungfrau"
#define GITREV 0x4481
#define GITDATE 0x20190328
#define GITBRANCH "refactor"

View File

@ -1285,25 +1285,20 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
return;
}
FILE_LOG(logINFO, ("Configuring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
FILE_LOG(logINFO, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
int valShift = val;
// convert to phase shift
if (degrees) {
double temp = val * ((double)maxShift / 360.00);
if ((temp - (int)temp) > 0.0001) {
temp += 0.5;
}
valShift = temp;
FILE_LOG(logDEBUG1, ("phase shift: %d\n", valShift));
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
}
FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val));
int relativePhase = clkPhase[ind] - valShift;
int relativePhase = valShift - clkPhase[ind];
FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind]));
// same phase
if (!relativePhase) {
FILE_LOG(logDEBUG1, ("Nothing to do\n"));
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
return;
}
@ -1323,7 +1318,10 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
int getPhase(enum CLKINDEX ind, int degrees) {
if (!degrees)
return clkPhase[ind];
return (clkPhase[ind] * (360.00 / (double)getMaxPhase(ind)));
// convert back to degrees
int val = 0;
ConvertToDifferentRange(0, getMaxPhase(ind) - 1, 0, 359, clkPhase[ind], &val);
return val;
}
int getMaxPhase(enum CLKINDEX ind) {
@ -1353,14 +1351,10 @@ int validatePhaseinDegrees(enum speedVariable ind, int val, int retval) {
FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", clkIndex));
int maxShift = getMaxPhase(clkIndex);
// convert degrees to shift
double temp = val;
temp *= ((double)maxShift / 360.00);
if ((temp - (int)temp) > 0.0001) {
temp += 0.5;
}
val = (int)temp;
int valShift = 0;
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
// convert back to degrees
val *= (360.00 / (double)maxShift);
ConvertToDifferentRange(0, maxShift - 1, 0, 359, valShift, &val);
if (val == retval)
return OK;
@ -1382,7 +1376,7 @@ void configureFrequency(enum CLKINDEX ind, int val) {
// reset phase
if (ind == ADC_CLK || ind == DBIT_CLK) {
FILE_LOG(logDEBUG1, ("Reseting phase of %s\n", clock_names[ind]));
FILE_LOG(logINFO, ("\tReseting phase of %s\n", clock_names[ind]));
configurePhase(ind, 0, 0);
}
@ -2004,7 +1998,7 @@ void readSample(int ns) {
// loop through all channels
int ich = 0;
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
for (ich = 0; ich < NCHAN; ++ich) {
// if channel is in ROI
if ((1 << ich) & ~(adcDisableMask)) {