M3threshold (#475)

* vicin default changed to 800, only setting vthx directly allows to set dac even if counter disabled, else disable counter, setallthresholdenergy if an energy is -1, get module value, fix that reg was repaced by isettings

* vth3 disabled for interpolation enable, interpolation disable sets counter mask to what it was before (updating old mask whn setting counter mask except for setting all counters for interpolation enable) and enabling vth3 if counter was enabled

* refactor and test for previous commit

* pump probe only has vth2 enabled, handles both pump probe mode and interpolation mode as well

* wip

* refactored pump probe and interpolation and added to setmodule

* check dacs and trimbits out of range for setmodule (not just threshold)

* binaries in

* m3: pump probe and interpolation mutually exclusive

* minor
This commit is contained in:
Dhanya Thattil
2022-06-07 16:55:33 +02:00
committed by GitHub
parent 25b5b02302
commit 1fb90ab98c
14 changed files with 335 additions and 227 deletions

View File

@ -281,6 +281,7 @@ int getNumDigitalSamples();
#endif
#ifdef MYTHEN3D
void setCounterMask(uint32_t arg);
void setCounterMaskWithUpdateFlag(uint32_t arg, int updateMaskFlag);
uint32_t getCounterMask();
void updatePacketizing();
#endif
@ -347,9 +348,12 @@ void setThresholdEnergy(int counterIndex, int eV);
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val);
int getOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex);
#endif
void setDAC(enum DACINDEX ind, int val, int mV);
#ifdef MYTHEN3D
void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck);
void setGeneralDAC(enum DACINDEX ind, int val, int mV);
void setVthDac(int index, int enable);
#else
void setDAC(enum DACINDEX ind, int val, int mV);
#endif
int getDAC(enum DACINDEX ind, int mV);
int getMaxDacSteps();

View File

@ -1288,7 +1288,12 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
LOG(logERROR, (mess));
} else
#endif
#ifdef MYTHEN3D
// ignore counter enable to force vth dac values
setDAC(serverDacIndex, val, mV, 0);
#else
setDAC(serverDacIndex, val, mV);
#endif
retval = getDAC(serverDacIndex, mV);
}
#ifdef EIGERD
@ -9944,19 +9949,25 @@ int set_interpolation(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
ret = setInterpolation(arg);
if (ret == FAIL) {
if (arg)
sprintf(mess, "Could not set interpolation or enable all "
"counters for it.\n");
else
sprintf(mess, "Could not set interpolation\n");
if (getPumpProbe() && arg) {
ret = FAIL;
sprintf(mess, "Could not set interpolation. Disable pump probe mode first.\n");
LOG(logERROR, (mess));
} else {
int retval = getInterpolation();
validate(&ret, mess, (int)arg, (int)retval, "set interpolation",
DEC);
LOG(logDEBUG1, ("interpolation retval: %u\n", retval));
} else {
ret = setInterpolation(arg);
if (ret == FAIL) {
if (arg)
sprintf(mess, "Could not set interpolation or enable all "
"counters for it.\n");
else
sprintf(mess, "Could not set interpolation\n");
LOG(logERROR, (mess));
} else {
int retval = getInterpolation();
validate(&ret, mess, (int)arg, (int)retval, "set interpolation",
DEC);
LOG(logDEBUG1, ("interpolation retval: %u\n", retval));
}
}
}
#endif
@ -9994,14 +10005,20 @@ int set_pump_probe(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
ret = setPumpProbe(arg);
if (ret == FAIL) {
sprintf(mess, "Could not set pump probe\n");
if (getInterpolation() && arg) {
ret = FAIL;
sprintf(mess, "Could not set pump probe mode. Disable interpolation mode first.\n");
LOG(logERROR, (mess));
} else {
int retval = getPumpProbe();
validate(&ret, mess, (int)arg, (int)retval, "set pump probe", DEC);
LOG(logDEBUG1, ("pump probe retval: %u\n", retval));
} else {
ret = setPumpProbe(arg);
if (ret == FAIL) {
sprintf(mess, "Could not set pump probe\n");
LOG(logERROR, (mess));
} else {
int retval = getPumpProbe();
validate(&ret, mess, (int)arg, (int)retval, "set pump probe", DEC);
LOG(logDEBUG1, ("pump probe retval: %u\n", retval));
}
}
}
#endif