[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.ai_device = self.device.get_ai_device()
|
||||||
self.channels = channels
|
self.channels = channels
|
||||||
|
|
||||||
|
self.stop = False
|
||||||
|
|
||||||
def read_analog_continously(
|
def read_analog_continously(
|
||||||
self,
|
self,
|
||||||
*args,
|
*args,
|
||||||
@ -67,7 +69,7 @@ class DaqProducer:
|
|||||||
while daq_status != uldaq.ScanStatus.IDLE:
|
while daq_status != uldaq.ScanStatus.IDLE:
|
||||||
prev_count = 0
|
prev_count = 0
|
||||||
prev_index = 0
|
prev_index = 0
|
||||||
while time.time() - start_time < 10:
|
while not self.stop:
|
||||||
daq_status, transfer_status = self.ai_device.get_scan_status()
|
daq_status, transfer_status = self.ai_device.get_scan_status()
|
||||||
# The index into the data buffer immediately following the last sample transferred.
|
# The index into the data buffer immediately following the last sample transferred.
|
||||||
current_index = transfer_status.current_index
|
current_index = transfer_status.current_index
|
||||||
@ -154,17 +156,20 @@ class DaqProducer:
|
|||||||
break
|
break
|
||||||
return "Done. "
|
return "Done. "
|
||||||
|
|
||||||
|
def stop_aquisition(self):
|
||||||
if __name__ == "__main__":
|
self.stop = True
|
||||||
devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
|
||||||
log.debug(f"Found daq devices {len(devices)}, connecting to the first one")
|
|
||||||
try:
|
# if __name__ == "__main__":
|
||||||
daq_device = uldaq.DaqDevice(devices[0])
|
# devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
||||||
except uldaq.ul_exception.ULException as e:
|
# log.debug(f"Found daq devices {len(devices)}, connecting to the first one")
|
||||||
log.error("Did not found daq devices, please connect one")
|
# try:
|
||||||
raise e
|
# daq_device = uldaq.DaqDevice(devices[0])
|
||||||
daq_device.connect()
|
# except uldaq.ul_exception.ULException as e:
|
||||||
|
# log.error("Did not found daq devices, please connect one")
|
||||||
buf = CircBuffer(size=1_000_000, samplerate=100)
|
# raise e
|
||||||
producer = DaqProducer(buf, daq_device, [1, 1])
|
# daq_device.connect()
|
||||||
producer.read_analog_continously()
|
#
|
||||||
|
# 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