m3: vthreshold set/get only enabled counters but remember value, vth always overwrite, disable counter sets vth to 2800, enable counter sets saved values

This commit is contained in:
2021-05-27 17:25:55 +02:00
parent 54c24b3de7
commit daae52ca63
4 changed files with 101 additions and 101 deletions

View File

@ -1238,34 +1238,6 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
ret = OK;
} else {
ret = FAIL;
#ifdef MYTHEN3D
// give a different exception message if counter not enabled
int isCounterError = 0;
if (serverDacIndex == M_VTHRESHOLD ||
serverDacIndex == M_VTH1 || serverDacIndex == M_VTH2 ||
serverDacIndex == M_VTH3) {
uint32_t counter_retval = getCounterMask();
// vthreshold, all counters should have been enabled
if (serverDacIndex == M_VTHRESHOLD) {
if (counter_retval != MAX_COUNTER_MSK) {
isCounterError = 1;
}
}
// corresponding counter should have been enabled
else {
int vthdacs[] = {M_VTH1, M_VTH2, M_VTH3};
for (int i = 0; i < NCOUNTERS; ++i) {
if ((vthdacs[i] == (int)serverDacIndex) &&
(!(counter_retval & (1 << i)))) {
isCounterError = 1;
}
}
}
}
if (isCounterError) {
strcpy(mess, "Could not set dac as counter disabled\n");
} else
#endif
sprintf(mess, "Setting dac %d : wrote %d but read %d\n",
serverDacIndex, val, retval);
LOG(logERROR, (mess));