Merge branch 'g2' into m3

This commit is contained in:
2020-07-29 17:15:37 +02:00
12 changed files with 79 additions and 87 deletions

View File

@ -374,26 +374,16 @@ void setupDetector() {
burstPeriodReg = 0;
filter = 0;
cdsGain = 0;
for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
for (int i = 0; i < NDAC; ++i) {
dacValues[i] = 0;
}
memset(clkPhase, 0, sizeof(clkPhase));
memset(dacValues, 0, sizeof(dacValues));
for (int i = 0; i < ONCHIP_NDAC; ++i) {
for (int j = 0; j < NCHIP; ++j) {
onChipdacValues[i][j] = -1;
}
}
for (int i = 0; i < NCHIP; ++i) {
for (int j = 0; j < NCHAN; ++j) {
vetoReference[i][j] = 0;
vetoGainIndices[i][j] = 0;
}
for (int j = 0; j < NADC; ++j) {
adcConfiguration[i][j] = 0;
}
}
memset(vetoReference, 0, sizeof(vetoReference));
memset(vetoGainIndices, 0, sizeof(vetoGainIndices));
memset(adcConfiguration, 0, sizeof(adcConfiguration));
#ifdef VIRTUAL
sharedMemory_setStatus(IDLE);
#endif
@ -1789,9 +1779,7 @@ int setVetoReference(int gainIndex, int value) {
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n",
gainIndex, value));
int values[NCHAN];
memset(values, 0, sizeof(values));
int gainIndices[NCHAN];
memset(gainIndices, 0, sizeof(gainIndices));
for (int ich = 0; ich < NCHAN; ++ich) {
values[ich] = value;
gainIndices[ich] = gainIndex;

View File

@ -6332,16 +6332,14 @@ int set_veto_photon(int file_des) {
int args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
int chipIndex = args[0];
int numChannels = args[1];
const int chipIndex = args[0];
const int numChannels = args[1];
int gainIndices[args[1]];
memset(gainIndices, 0, sizeof(gainIndices));
int gainIndices[numChannels];
if (receiveData(file_des, gainIndices, sizeof(gainIndices), INT32) < 0)
return printSocketReadError();
int values[args[1]];
memset(values, 0, sizeof(values));
int values[numChannels];
if (receiveData(file_des, values, sizeof(values), INT32) < 0)
return printSocketReadError();
@ -6353,19 +6351,18 @@ int set_veto_photon(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
if (chipIndex < -1 || chipIndex >= NCHIP) {
ret = FAIL;
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
chipIndex);
LOG(logERROR, (mess));
} else if (numChannels != NCHAN) {
if (numChannels != NCHAN) {
ret = FAIL;
sprintf(mess,
"Could not set veto photon. Invalid number of channels %d. "
"Expected %d\n",
numChannels, NCHAN);
LOG(logERROR, (mess));
} else if (chipIndex < -1 || chipIndex >= NCHIP) {
ret = FAIL;
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
chipIndex);
LOG(logERROR, (mess));
} else {
for (int i = 0; i < NCHAN; ++i) {
if (gainIndices[i] < 0 || gainIndices[i] > 2) {