[dataio/daq] adding stop signal from gui, commentin out
This commit is contained in:
parent
b5f8d7663d
commit
2539fa7e25
@ -22,6 +22,8 @@ class DaqProducer:
|
||||
self.ai_device = self.device.get_ai_device()
|
||||
self.channels = channels
|
||||
|
||||
self.stop = False
|
||||
|
||||
def read_analog_continously(
|
||||
self,
|
||||
*args,
|
||||
@ -67,7 +69,7 @@ class DaqProducer:
|
||||
while daq_status != uldaq.ScanStatus.IDLE:
|
||||
prev_count = 0
|
||||
prev_index = 0
|
||||
while time.time() - start_time < 10:
|
||||
while not self.stop:
|
||||
daq_status, transfer_status = self.ai_device.get_scan_status()
|
||||
# The index into the data buffer immediately following the last sample transferred.
|
||||
current_index = transfer_status.current_index
|
||||
@ -154,17 +156,20 @@ class DaqProducer:
|
||||
break
|
||||
return "Done. "
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
||||
log.debug(f"Found daq devices {len(devices)}, connecting to the first one")
|
||||
try:
|
||||
daq_device = uldaq.DaqDevice(devices[0])
|
||||
except uldaq.ul_exception.ULException as e:
|
||||
log.error("Did not found daq devices, please connect one")
|
||||
raise e
|
||||
daq_device.connect()
|
||||
|
||||
buf = CircBuffer(size=1_000_000, samplerate=100)
|
||||
producer = DaqProducer(buf, daq_device, [1, 1])
|
||||
producer.read_analog_continously()
|
||||
def stop_aquisition(self):
|
||||
self.stop = True
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
||||
# log.debug(f"Found daq devices {len(devices)}, connecting to the first one")
|
||||
# try:
|
||||
# daq_device = uldaq.DaqDevice(devices[0])
|
||||
# except uldaq.ul_exception.ULException as e:
|
||||
# log.error("Did not found daq devices, please connect one")
|
||||
# raise e
|
||||
# daq_device.connect()
|
||||
#
|
||||
# buf = CircBuffer(size=1_000_000, samplerate=100)
|
||||
# producer = DaqProducer(buf, daq_device, [1, 1])
|
||||
# producer.read_analog_continously()
|
||||
|
Loading…
Reference in New Issue
Block a user