mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-06-08 06:38:40 +02:00
added tolerance to exptime, fixed test
This commit is contained in:
@@ -1145,9 +1145,11 @@ int getNumTransceiverSamples() { return ntSamples; }
|
||||
int setExpTime(int64_t val) {
|
||||
setPatternWaitInterval(0, val);
|
||||
|
||||
// validate for tolerance
|
||||
// Tolerance: three clock periods in ns.
|
||||
int64_t retval = getExpTime();
|
||||
if (val != retval) {
|
||||
int64_t toleranceNs = 3 * (1000000000 / clkFrequency[RUN_CLK]);
|
||||
int64_t diff = val - retval;
|
||||
if (diff < -toleranceNs || diff > toleranceNs) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
|
||||
@@ -307,7 +307,9 @@ uint64_t getPatternWaitInterval(int level) {
|
||||
LOG(logERROR, ("runclk is 0. Cannot divide by 0. Returning -1.\n"));
|
||||
return -1;
|
||||
}
|
||||
return numClocks / (NS_TO_CLK_CYCLE * runclk);
|
||||
double conv = NS_TO_CLK_CYCLE * runclk;
|
||||
uint64_t waitNs = (uint64_t)(numClocks / conv + 0.5);
|
||||
return waitNs;
|
||||
}
|
||||
|
||||
int validate_setPatternWaitClocksAndInterval(char *message, int level,
|
||||
|
||||
@@ -5867,7 +5867,7 @@ int set_clock_frequency(int file_des) {
|
||||
if (getFrequency(c) == val) {
|
||||
LOG(logINFO, ("Same %s: %d %s\n", modeName, val, "Hz"));
|
||||
} else {
|
||||
int ret = setFrequency(c, val); // MM: Poblem
|
||||
int ret = setFrequency(c, val);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set %s to %d %s\n", modeName, val,"Hz");
|
||||
LOG(logERROR, (mess));
|
||||
|
||||
@@ -1055,9 +1055,11 @@ int getNumTransceiverSamples() {
|
||||
int setExpTime(int64_t val) {
|
||||
setPatternWaitInterval(0, val);
|
||||
|
||||
// validate for tolerance
|
||||
// Tolerance: three clock periods in ns.
|
||||
int64_t retval = getExpTime();
|
||||
if (val != retval) {
|
||||
int64_t toleranceNs = 3 * (1000000000 / clkFrequency[RUN_CLK]);
|
||||
int64_t diff = val - retval;
|
||||
if (diff < -toleranceNs || diff > toleranceNs) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
|
||||
Reference in New Issue
Block a user