Skip to content

Commit a7e2f19

Browse files
committed
Initialize aiInputMode_; fix problems reading voltage on USB-TEMP-AI
1 parent 3a16527 commit a7e2f19

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

measCompApp/src/drvMultiFunction.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,7 @@ MultiFunction::MultiFunction(const char *portName, const char *uniqueID, int max
12651265
setIntegerParam(waveDigRun_, 0);
12661266
setIntegerParam(waveGenRun_, 0);
12671267
setDoubleParam(pollSleepMS_, 50.);
1268+
aiInputMode_ = AI_SINGLE_ENDED;
12681269
for (i=0; i<numTemperatureIn_; i++) {
12691270
setIntegerParam(i, thermocoupleType_, TC_TYPE_J);
12701271
}
@@ -2672,9 +2673,7 @@ void MultiFunction::pollerThread()
26722673
double tempValue;
26732674
getIntegerParam(0, analogInMode_, &mode);
26742675
for (i=0; i<numAnalogIn_; i++) {
2675-
getIntegerParam(i, analogInRange_, &range);
2676-
getIntegerParam(i, analogInType_, &type);
2677-
if (type != AI_CHAN_TYPE_VOLTAGE) continue;
2676+
getIntegerParam(i, voltageInRange_, &range);
26782677
if ((boardType_ == E_1608) && (mode == DIFFERENTIAL) && (i>3)) break;
26792678
if (boardType_ == USB_TEMP_AI) {
26802679
// USB_TEMP_AI reads voltage as floating point
@@ -2693,10 +2692,12 @@ void MultiFunction::pollerThread()
26932692
// This can only be done by setting the value once to a different value, then the correct value
26942693
setDoubleParam(i, voltageInValue_, tempValue+1);
26952694
setDoubleParam(i, voltageInValue_, tempValue);
2696-
//if (i==0) asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "ulAIn chan=%d, tempValue=%f\n", i, tempValue);
26972695
}
26982696
else {
26992697
// Models other than USB_TEMP_AI read voltage as integer
2698+
getIntegerParam(i, analogInRange_, &range);
2699+
getIntegerParam(i, analogInType_, &type);
2700+
if (type != AI_CHAN_TYPE_VOLTAGE) continue;
27002701
#ifdef _WIN32
27012702
if (ADCResolution_ <= 16) {
27022703
epicsUInt16 shortVal;

0 commit comments

Comments
 (0)