diff --git a/include/villas/nodes/uldaq.h b/include/villas/nodes/uldaq.h index 43ccd3603..cc807f444 100644 --- a/include/villas/nodes/uldaq.h +++ b/include/villas/nodes/uldaq.h @@ -41,15 +41,16 @@ extern "C" { struct uldaq { struct { - int sample_count; - double sample_rate; - ScanOption scan_options; - AInScanFlag flags; - AiQueueElement queues; - AiInputMode inputMode; - DaqDeviceDescriptor devDescriptor; - DaqDeviceInterface interfaceType = ANY_IFC; - DaqDeviceHandle daqDeviceHandle = 0; + int sample_count; + double sample_rate; + ScanOption scan_options; + AInScanFlag flags; + AiQueueElement queues; + AiInputMode inputMode; + DaqDeviceDescriptor devDescriptor; + DaqDeviceInterface interfaceType; + DaqDeviceHandle daqDeviceHandle + double* buffer; } in; struct { diff --git a/lib/nodes/uldaq.c b/lib/nodes/uldaq.c index 5d4ffb41e..333cec23f 100644 --- a/lib/nodes/uldaq.c +++ b/lib/nodes/uldaq.c @@ -136,12 +136,9 @@ int uldaq_start(struct node *n) Range ranges[MAX_RANGE_COUNT]; - DaqDeviceDescriptor u->devDescriptors[MAX_DEV_COUNT]; - DaqDeviceInterface u->interfaceType = ANY_IFC; - DaqDeviceHandle u->daqDeviceHandle = 0; int numRanges = 0; int descriptorIndex = 0; - unsigned int numDevs = MAX_DEV_COUNT; + unsigned int numDevs = 1; UlError err = ERR_NO_ERROR; AiInputMode u->inputMode = AI_SINGLE_ENDED; int chanCount = 1;//change this to use more than one channel @@ -216,6 +213,9 @@ int uldaq_stop(struct node *n) struct uldaq *u = (struct uldaq *) n->_vd; + // get the current status of the acquisition + err = ulAInScanStatus(u->daqDeviceHandle, &status, &transferStatus); + UlError err = ERR_NO_ERROR; // stop the acquisition if it is still running if (status == SS_RUNNING && err == ERR_NO_ERROR) ulAInScanStop(u->daqDeviceHandle); @@ -232,6 +232,7 @@ int uldaq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re int avail; struct uldaq *u = (struct uldaq *) n->_vd; + UlError err = ERR_NO_ERROR; if (status == SS_RUNNING && err == ERR_NO_ERROR) { // get the current status of the acquisition err = ulAInScanStatus(u->daqDeviceHandle, &status, &transferStatus);