mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 16:48:01 +02:00
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:
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/ctbDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: c7ad548e4c2026a826b9f269f32d9970ce0a44e8
|
||||
Revision: 48
|
||||
Repsitory UUID: 5a4122ae7c8dae1572e9db336de70183956e58c7
|
||||
Revision: 50
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4478
|
||||
Last Changed Date: 2019-03-27 11:13:21.000000002 +0100 ../slsDetectorServer/slsDetectorServer_funcs.c
|
||||
Last Changed Rev: 4481
|
||||
Last Changed Date: 2019-03-28 08:18:03.000000002 +0100 ../slsDetectorServer/slsDetectorFunctionList.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "c7ad548e4c2026a826b9f269f32d9970ce0a44e8"
|
||||
#define GITREPUUID "5a4122ae7c8dae1572e9db336de70183956e58c7"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4478
|
||||
#define GITDATE 0x20190327
|
||||
#define GITREV 0x4481
|
||||
#define GITDATE 0x20190328
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -1649,25 +1649,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;
|
||||
}
|
||||
|
||||
@ -1687,7 +1682,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) {
|
||||
@ -1717,14 +1715,11 @@ 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;
|
||||
// convert degrees to shift
|
||||
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;
|
||||
@ -1746,7 +1741,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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user