From 88eac63bb84fa04a6105f7e205defe590a4c1760 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 30 Oct 2023 23:21:00 +0000 Subject: [PATCH 1/2] Add averaging of sampels read into single value --- DAQmxBaseApp/src/drvDaqMxBase.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DAQmxBaseApp/src/drvDaqMxBase.c b/DAQmxBaseApp/src/drvDaqMxBase.c index 2b6acf2..a4e62b8 100644 --- a/DAQmxBaseApp/src/drvDaqMxBase.c +++ b/DAQmxBaseApp/src/drvDaqMxBase.c @@ -3960,9 +3960,18 @@ static void daqThread(void *param) /*asynPrint(pPvt->pasynUser, ASYN_TRACE_FLOW, "sending IO/intr (signal=%d).\n",signal);*/ if (signal >= 0 && signal < pPvt->nChannels) { + int i; + epicsFloat64 value = *(epicsFloat64*)pPvt->aioPvt[signal]->data; + if (pPvt->samplesRead > 0) { + value = 0.0; + for(i = 0; isamplesRead; ++i) { + value += ((epicsFloat64*)pPvt->aioPvt[signal]->data)[i]; + } + value /= (epicsFloat64)pPvt->samplesRead; + } pFloat64Interrupt->callback(pFloat64Interrupt->userPvt, pFloat64Interrupt->pasynUser, - *(epicsFloat64*)pPvt->aioPvt[signal]->data); + value); } } pNode = (interruptNode *)ellNext(&pNode->node); From a17ef2bede7e5ae29033b4f41fa84d7187b03b13 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Fri, 17 Nov 2023 00:41:58 +0000 Subject: [PATCH 2/2] Fix interrupt callback error --- DAQmxBaseApp/src/drvDaqMxBase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DAQmxBaseApp/src/drvDaqMxBase.c b/DAQmxBaseApp/src/drvDaqMxBase.c index a4e62b8..818fb16 100644 --- a/DAQmxBaseApp/src/drvDaqMxBase.c +++ b/DAQmxBaseApp/src/drvDaqMxBase.c @@ -3976,7 +3976,7 @@ static void daqThread(void *param) } pNode = (interruptNode *)ellNext(&pNode->node); } - pasynManager->interruptEnd(pPvt->float64ArrayInterruptPvt); + pasynManager->interruptEnd(pPvt->float64InterruptPvt); epicsMutexUnlock(pPvt->lock); oldtp = tp;