mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
ctb server bug fixes:update client, get period left, getid(api and serial number), restrict setting vchip, allow write adc
This commit is contained in:
parent
09546a8632
commit
a4f1b7670f
@ -970,6 +970,11 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
retval = get64BitReg(PERIOD_LEFT_LSB_REG, PERIOD_LEFT_MSB_REG) / (1E-3 * clkDivider[ADC_CLK]);
|
||||
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
retval = get64BitReg(DELAY_LEFT_LSB_REG, DELAY_LEFT_MSB_REG) / (1E-3 * clkDivider[ADC_CLK]);
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
|
@ -501,7 +501,7 @@ int get_id(int file_des) {
|
||||
|
||||
// get
|
||||
switch (arg) {
|
||||
#if defined(EIGERD) || defined(JUNGFRAUD)
|
||||
#ifndef GOTTHARDD
|
||||
case SOFTWARE_FIRMWARE_API_VERSION:
|
||||
case DETECTOR_SERIAL_NUMBER:
|
||||
#endif
|
||||
@ -818,6 +818,10 @@ int set_dac(int file_des) {
|
||||
|
||||
case V_POWER_CHIP:
|
||||
if (val >= 0) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Can not set Vchip. Can only be set automatically in the background (+200mV from highest power regulator voltage).\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
/* restrict users from setting vchip
|
||||
if (!mV) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not set Vchip. Should be in mV and not dac units.\n");
|
||||
@ -829,6 +833,7 @@ int set_dac(int file_des) {
|
||||
} else {
|
||||
setVchip(val);
|
||||
}
|
||||
*/
|
||||
}
|
||||
retval = getVchip();
|
||||
FILE_LOG(logDEBUG1, ("Vchip: %d\n", retval));
|
||||
@ -1551,7 +1556,7 @@ int set_timer(int file_des) {
|
||||
case FRAME_PERIOD:
|
||||
case CYCLES_NUMBER:
|
||||
case SAMPLES:
|
||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#ifndef EIGERD
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
#endif
|
||||
retval = setTimer(ind, tns);
|
||||
@ -1696,6 +1701,7 @@ int get_time_left(int file_des) {
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
#elif MOENCHD
|
||||
@ -1704,6 +1710,7 @@ int get_time_left(int file_des) {
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
#endif
|
||||
@ -1796,7 +1803,7 @@ int set_readout_flags(int file_des) {
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting readout flags to %d\n", arg));
|
||||
|
||||
#if (!defined(EIGERD)) && (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD))
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// set & get
|
||||
@ -1874,7 +1881,7 @@ int set_roi(int file_des) {
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// set & get
|
||||
@ -2120,9 +2127,11 @@ int send_update(int file_des) {
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD)
|
||||
i32 = (int)getSettings();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
#ifdef EIGERD
|
||||
i32 = getThresholdEnergy(GET_FLAG);
|
||||
@ -2134,7 +2143,7 @@ int send_update(int file_des) {
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
#ifndef CHIPTESTBOARDD
|
||||
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD)
|
||||
i64 = setTimer(ACQUISITION_TIME,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
@ -2164,16 +2173,18 @@ int send_update(int file_des) {
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
#ifdef CHIPTESTBOARDD
|
||||
i64 = setTimer(SAMPLES,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
#if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
i32 = setReadOutFlags(GET_READOUT_FLAGS);
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
i64 = setTimer(SAMPLES,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
if (lockStatus == 0) {
|
||||
strcpy(lastClientIP,thisClientIP);
|
||||
}
|
||||
@ -2731,7 +2742,7 @@ int write_adc_register(int file_des) {
|
||||
#ifndef VIRTUAL
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
#ifdef JUNGFRAUD
|
||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
AD9257_Set(addr, val);
|
||||
#elif GOTTHARDD
|
||||
if (getBoardRevision() == 1) {
|
||||
@ -2995,7 +3006,7 @@ int program_fpga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
#if (!defined(JUNGFRAUD)) && (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
||||
#if defined(EIGERD) || defined(GOTTHARDD)
|
||||
//to receive any arguments
|
||||
int n = 1;
|
||||
while (n > 0)
|
||||
@ -3121,7 +3132,7 @@ int reset_fpga(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Reset FPGA\n"));
|
||||
#if (!defined(JUNGFRAUD)) && (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
||||
#if defined(EIGERD) || defined(GOTTHARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
|
@ -1033,28 +1033,37 @@ int slsDetector::updateDetectorNoWait(sls::ClientSocket &client) {
|
||||
n += client.receiveData(lastClientIP, sizeof(lastClientIP));
|
||||
FILE_LOG(logDEBUG1) << "Updating detector last modified by " << lastClientIP;
|
||||
|
||||
// dr
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->dynamicRange = i32;
|
||||
|
||||
// databytes
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->dataBytes = i32;
|
||||
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->currentSettings = (detectorSettings)i32;
|
||||
// settings
|
||||
if ((thisDetector->myDetectorType != CHIPTESTBOARD) && (thisDetector->myDetectorType != MOENCH)) {
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->currentSettings = (detectorSettings)i32;
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->currentThresholdEV = i32;
|
||||
}
|
||||
|
||||
// frame number
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[FRAME_NUMBER] = i64;
|
||||
|
||||
if (thisDetector->myDetectorType != CHIPTESTBOARD) {
|
||||
// exptime
|
||||
if ((thisDetector->myDetectorType != CHIPTESTBOARD) && (thisDetector->myDetectorType != MOENCH)) {
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[ACQUISITION_TIME] = i64;
|
||||
}
|
||||
|
||||
// subexptime, subdeadtime
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] = i64;
|
||||
@ -1063,29 +1072,37 @@ int slsDetector::updateDetectorNoWait(sls::ClientSocket &client) {
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME] = i64;
|
||||
}
|
||||
|
||||
// period
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[FRAME_PERIOD] = i64;
|
||||
|
||||
// delay
|
||||
if (thisDetector->myDetectorType != EIGER) {
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER] = i64;
|
||||
}
|
||||
|
||||
// cycles
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
thisDetector->timerValue[CYCLES_NUMBER] = i64;
|
||||
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD) {
|
||||
// readout flags
|
||||
if (thisDetector->myDetectorType == EIGER ||
|
||||
thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->roFlags = (readOutFlags)i32;
|
||||
}
|
||||
|
||||
// samples
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
|
||||
n += client.receiveData(&i64, sizeof(i64));
|
||||
if (i64 >= 0) {
|
||||
thisDetector->timerValue[SAMPLES] = i64;
|
||||
}
|
||||
|
||||
n += client.receiveData(&i32, sizeof(i32));
|
||||
thisDetector->roFlags = (readOutFlags)i32;
|
||||
|
||||
getTotalNumberOfChannels();
|
||||
}
|
||||
|
||||
|
||||
if (!n) {
|
||||
FILE_LOG(logERROR) << "Could not update detector, received 0 bytes";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user