This commit is contained in:
2021-07-29 17:26:45 +02:00
parent 9c03e83ef1
commit 9f11dae703
8 changed files with 103 additions and 28 deletions

View File

@ -49,6 +49,7 @@ int highvoltage = 0;
int dacValues[NDAC] = {};
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
int defaultDacValues[NDAC] = {};
int hardCodedDefaultDacValues[NDAC] = {};
int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {};
int injectedChannelsOffset = 0;
int injectedChannelsIncrement = 0;
@ -393,6 +394,7 @@ void setupDetector() {
memset(dacValues, 0, sizeof(dacValues));
for (int i = 0; i < NDAC; ++i) {
defaultDacValues[i] = -1;
hardCodedDefaultDacValues[i] = -1;
}
for (int i = 0; i < ONCHIP_NDAC; ++i) {
for (int j = 0; j < NCHIP; ++j) {
@ -484,9 +486,8 @@ void setupDetector() {
int resetToDefaultDacs(int hardReset) {
// reset defaults to hardcoded defaults
if (hardReset) {
const int vals[] = DEFAULT_DAC_VALS;
for (int i = 0; i < NDAC; ++i) {
defaultDacValues[i] = vals[i];
defaultDacValues[i] = hardCodedDefaultDacValues[i];
}
}
// reset dacs to defaults
@ -839,6 +840,7 @@ int readConfigFile() {
// set default dac variables
defaultDacValues[idac] = value;
hardCodedDefaultDacValues[idac] = value;
// set dac
setDAC(idac, value, 0);