m3:different exception message for vths when counter disabled

This commit is contained in:
2021-05-26 12:23:46 +02:00
parent 240ec12485
commit 89898beced

View File

@ -1240,11 +1240,29 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
ret = FAIL; ret = FAIL;
#ifdef MYTHEN3D #ifdef MYTHEN3D
// give a different exception message if counter not enabled // give a different exception message if counter not enabled
uint32_t counter_retval = getCounterMask(); int isCounterError = 0;
if ((serverDacIndex == M_VTHRESHOLD || if (serverDacIndex == M_VTHRESHOLD ||
serverDacIndex == M_VTH1 || serverDacIndex == M_VTH2 || serverDacIndex == M_VTH1 || serverDacIndex == M_VTH2 ||
serverDacIndex == M_VTH3) && serverDacIndex == M_VTH3) {
counter_retval != MAX_COUNTER_MSK) { 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"); strcpy(mess, "Could not set dac as counter disabled\n");
} else } else
#endif #endif