Bugfix for non-consecutive channel counts in UlDAQ
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Anne de Jong 2023-03-10 15:53:55 +01:00
parent 2b22af5d2c
commit 617eded04e

View File

@ -206,13 +206,15 @@ InBufHandler::InBufHandler(DT9837A &daq, InDaqCallback cb)
// Set ranges for each input. Below asks only channels that are not a // Set ranges for each input. Below asks only channels that are not a
// monitor channel (hence the false flag). // monitor channel (hence the false flag).
dvec ranges = daq.inputRangeForEnabledChannels(false); dvec ranges = daq.inputRangeForEnabledChannels(false);
us enabled_ch_count = 0;
for (us chin = 0; chin < 4; chin++) { for (us chin = 0; chin < 4; chin++) {
if (eninchannels_without_mon[chin] == true) { if (eninchannels_without_mon[chin] == true) {
DaqInChanDescriptor indesc; DaqInChanDescriptor indesc;
indesc.type = DAQI_ANALOG_SE; indesc.type = DAQI_ANALOG_SE;
indesc.channel = chin; indesc.channel = chin;
double rangeval = ranges.at(chin); double rangeval = ranges.at(enabled_ch_count);
Range rangenum; Range rangenum;
if (fabs(rangeval - 1.0) < 1e-8) { if (fabs(rangeval - 1.0) < 1e-8) {
rangenum = BIP1VOLTS; rangenum = BIP1VOLTS;
@ -225,6 +227,7 @@ InBufHandler::InBufHandler(DT9837A &daq, InDaqCallback cb)
} }
indesc.range = rangenum; indesc.range = rangenum;
indescs.push_back(indesc); indescs.push_back(indesc);
enabled_ch_count++;
} }
} }