From 441685ad323454046cf105872915b96cdc3165e1 Mon Sep 17 00:00:00 2001 From: Thijs Hekman Date: Tue, 25 Oct 2022 16:45:48 +0200 Subject: [PATCH] Bugfix for non contiguous channels are enabled on UlDAQ --- src/lasp/device/lasp_uldaq.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lasp/device/lasp_uldaq.cpp b/src/lasp/device/lasp_uldaq.cpp index 8a4965d..d74fab5 100644 --- a/src/lasp/device/lasp_uldaq.cpp +++ b/src/lasp/device/lasp_uldaq.cpp @@ -180,16 +180,22 @@ public: std::vector indescs; boolvec eninchannels_without_mon = daq.eninchannels(false); - + DEBUGTRACE_PRINT(eninchannels_without_mon.size()); + // Initialize input, if any dvec ranges = daq.inputRangeForEnabledChannels(false); + + // Update range index only when an enabled channel is found. + us range_idx = 0; + for (us chin = 0; chin < 4; chin++) { if (eninchannels_without_mon[chin] == true) { DaqInChanDescriptor indesc; indesc.type = DAQI_ANALOG_SE; indesc.channel = chin; - double rangeval = ranges.at(chin); + double rangeval = ranges.at(range_idx); + range_idx++; Range rangenum; if (fabs(rangeval - 1.0) < 1e-8) { rangenum = BIP1VOLTS;