diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c index e924ab9a6..312165ef1 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c @@ -907,20 +907,15 @@ int64_t getFrames(){ int64_t setExposureTime(int64_t value){ /* time is in ns */ if (value!=-1) { - double actualvalue = value*(1E-9*CLK_FREQ); - value*=(1E-9*CLK_FREQ); - if(fabs(actualvalue-value)>= 0.5){ - if(actualvalue > value) - value++; - else - value--; - } + value = (value * 1E-3 * CLK_FREQ ) + 0.5; } - return set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG)/(1E-9*CLK_FREQ); + return (set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t getExposureTime(){ - return get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG)/(1E-9*CLK_FREQ); + return (get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t setGates(int64_t value){ @@ -934,23 +929,15 @@ int64_t getGates(){ int64_t setPeriod(int64_t value){ /* time is in ns */ if (value!=-1) { - double actualvalue = value*(1E-9*CLK_FREQ); - value*=(1E-9*CLK_FREQ); - if(fabs(actualvalue-value)>= 0.5){ - if(actualvalue > value) - value++; - else - value--; - } + value = (value * 1E-3 * CLK_FREQ ) + 0.5; } - - - - return set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-9*CLK_FREQ); + return (set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t getPeriod(){ - return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG)/(1E-9*CLK_FREQ); + return (get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t setDelay(int64_t value){ @@ -960,16 +947,10 @@ int64_t setDelay(int64_t value){ value += masterdefaultdelay; cprintf(BLUE,"Actual delay for master: %lld\n", (long long int) value); } - double actualvalue = value*(1E-9*CLK_FREQ); - value*=(1E-9*CLK_FREQ); - if(fabs(actualvalue-value)>= 0.5){ - if(actualvalue > value) - value++; - else - value--; - } + value = (value * 1E-3 * CLK_FREQ ) + 0.5; } - int64_t retval = set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-9*CLK_FREQ); + int64_t retval = (set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; if (masterflags == IS_MASTER) { cprintf(BLUE,"Actual delay read from master: %lld\n", (long long int) retval); retval -= masterdefaultdelay; @@ -979,7 +960,8 @@ int64_t setDelay(int64_t value){ } int64_t getDelay(){ - return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG)/(1E-9*CLK_FREQ); + return (get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t setTrains(int64_t value){ @@ -997,37 +979,26 @@ int64_t setProbes(int64_t value){ int64_t setProgress() { - //????? eventually call after setting the registers - return 0; } int64_t getProgress() { - - //should be done in firmware!!!! - return 0; } int64_t getActualTime(){ - return get64BitReg(GET_ACTUAL_TIME_LSB_REG, GET_ACTUAL_TIME_MSB_REG)/(1E-9*CLK_FREQ); + return (get64BitReg(GET_ACTUAL_TIME_LSB_REG, GET_ACTUAL_TIME_MSB_REG) / + (1E-3 * CLK_FREQ)) + 0.5; } int64_t getMeasurementTime(){ int64_t v=get64BitReg(GET_MEASUREMENT_TIME_LSB_REG, GET_MEASUREMENT_TIME_MSB_REG); - /* u_int64_t mask=0x8000000000000000; - if (v & mask ) { -#ifdef VERBOSE - printf("no measurement time left\n"); -#endif - return -1E+9; - } else*/ - return v/(1E-9*CLK_FREQ); + return (v / (1E-3 * CLK_FREQ)) + 0.5; } diff --git a/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt b/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt index 07dfecd13..221f5726a 100644 --- a/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt +++ b/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git -Repsitory UUID: 34b659fa1549f13575012a50183b0ec8f4c82ec4 -Revision: 234 -Branch: gotthardversioning +Repsitory UUID: 711e0d771edb48e77fa23d965f026add268a31ee +Revision: 235 +Branch: 3.3.0-rc Last Changed Author: Dhanya_Thattil -Last Changed Rev: 3849 -Last Changed Date: 2018-05-29 12:09:14.000000002 +0200 ./server_funcs.c +Last Changed Rev: 3944 +Last Changed Date: 2018-07-26 13:38:23.000000002 +0200 ./server_defs.h diff --git a/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h b/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h index 60b7ef2f3..51379f12f 100644 --- a/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h +++ b/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h @@ -1,6 +1,6 @@ #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" -#define GITREPUUID "34b659fa1549f13575012a50183b0ec8f4c82ec4" +#define GITREPUUID "711e0d771edb48e77fa23d965f026add268a31ee" #define GITAUTH "Dhanya_Thattil" -#define GITREV 0x3849 -#define GITDATE 0x20180529 -#define GITBRANCH "gotthardversioning" +#define GITREV 0x3944 +#define GITDATE 0x20180726 +#define GITBRANCH "3.3.0-rc" diff --git a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer index 4fd60e13d..6d3c38ff5 100755 Binary files a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer and b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer differ diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_defs.h b/slsDetectorSoftware/gotthardDetectorServer/server_defs.h index 794e76546..6dc6bf59d 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_defs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/server_defs.h @@ -54,7 +54,7 @@ #define DEBUGOUT #endif -#define CLK_FREQ 32.1E+6 +#define CLK_FREQ 32.007729 #endif diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 1fe501adf..7d503d296 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -5671,11 +5671,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index == SUBFRAME_PERIOD) { - // t=(int64_t)(val*1E+9); for precision of eg.0.0000325, following done - val*=1E9; - t = (int64_t)val; - if(fabs(val-t)) // to validate precision loss - t = t + val - t; //even t += vak-t loses precision + // +0.5 for precision of eg.0.0000325 + t = ( val * 1E9 + 0.5); }else t=(int64_t)val; }