mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 15:15:56 +01:00
WIP
This commit is contained in:
Binary file not shown.
@@ -35,32 +35,6 @@ int getChipStatusRegister(){
|
||||
return chipStatusRegister;
|
||||
}
|
||||
|
||||
// int setGainCaps(int caps){
|
||||
// int csr = getChipStatusRegister();
|
||||
|
||||
// int gain_mask = 0;
|
||||
// gain_mask |= 1 << CSR_C10pre;
|
||||
// gain_mask |= 1 << CSR_C15sh;
|
||||
// gain_mask |= 1 << CSR_C30sh;
|
||||
// gain_mask |= 1 << CSR_C50sh;
|
||||
// gain_mask |= 1 << CSR_C225ACsh;
|
||||
// gain_mask |= 1 << CSR_C15pre;
|
||||
|
||||
// LOG(logINFO, ("gain_mask: 0x%x\n", gain_mask));
|
||||
// LOG(logINFO, ("csr: 0x%x\n", csr));
|
||||
// csr &= ~gain_mask; //zero out the bits in the gain mask
|
||||
// LOG(logINFO, ("csr: 0x%x\n", csr));
|
||||
// caps &= gain_mask;
|
||||
// csr |= caps;
|
||||
|
||||
// LOG(logINFO, ("csr: 0x%x\n", csr));
|
||||
|
||||
// //now comes the actual setting
|
||||
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
patternParameters *setChipStatusRegister(int csr) {
|
||||
int iaddr=0;
|
||||
int nbits=18;
|
||||
|
||||
@@ -1061,30 +1061,13 @@ int64_t getMeasurementTime() {
|
||||
/* parameters - module, speed, readout */
|
||||
|
||||
int setModule(sls_detector_module myMod, char *mess) {
|
||||
|
||||
LOG(logINFO, ("Setting module\n"));
|
||||
|
||||
// settings
|
||||
if (myMod.reg >= 0) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
if (getSettings() != (enum detectorSettings)myMod.reg) {
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set module. Could not set settings to %d, read %d\n",
|
||||
myMod.reg, (int)getSettings());
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
detectorModules->reg = myMod.reg;
|
||||
}
|
||||
// custom trimbit file
|
||||
else {
|
||||
// changed for setsettings (direct),
|
||||
// custom trimbit file (setmodule with myMod.reg as -1),
|
||||
// change of dac (direct)
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
|
||||
if (setGainCaps(myMod.reg)){
|
||||
sprintf(mess, "Could not set module gain caps\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// dacs
|
||||
@@ -1108,24 +1091,12 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
}
|
||||
|
||||
// if settings given and cannot be validated (after setting dacs), return
|
||||
// error
|
||||
if (myMod.reg >= 0) {
|
||||
if (getSettings() != (enum detectorSettings)myMod.reg) {
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set module. The dacs in file do not correspond to "
|
||||
"settings %d\n",
|
||||
myMod.reg);
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// threshold
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
if (myMod.eV[i] >= 0) {
|
||||
setThresholdEnergy(i, myMod.eV[i]);
|
||||
}else{
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user