Compare commits

...

3 Commits

2 changed files with 23 additions and 11 deletions

View File

@ -107,10 +107,25 @@ class PyRelacs(QMainWindow):
data = 2 * np.sin(2 * np.pi * 10 * time) data = 2 * np.sin(2 * np.pi * 10 * time)
buffer = ctypes.c_double * len(time) buffer = ctypes.c_double * len(time)
buffer_ai = uldaq.create_float_buffer(1, len(time))
data_c = buffer(*data) data_c = buffer(*data)
log.debug(f"Created C_double data {data_c}") log.debug(f"Created C_double data {data_c}")
ao_device = self.daq_device.get_ao_device() ao_device = self.daq_device.get_ao_device()
ai_device = self.daq_device.get_ai_device()
er = ai_device.a_in_scan(
1,
1,
uldaq.AiInputMode.SINGLE_ENDED,
uldaq.Range.BIP10VOLTS,
int(len(data)),
30_000.0,
uldaq.ScanOption.EXTTRIGGER,
uldaq.AInScanFlag.DEFAULT,
data=buffer_ai,
)
# ai_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, timeout=-1)
err = ao_device.a_out_scan( err = ao_device.a_out_scan(
0, 0,
@ -122,8 +137,11 @@ class PyRelacs(QMainWindow):
uldaq.AOutScanFlag.DEFAULT, uldaq.AOutScanFlag.DEFAULT,
data_c, data_c,
) )
while ao_device.get_scan_status()[0] == 1: # INFO: Need to wait for the acquistion
log.debug("Still running") self.daq_disconnect_button.setDisabled(True)
self.daq_connect_button.setEnabled(True)
embed()
exit()
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,12 +1,6 @@
import pathlib import traceback
import sys
import tomli from PyQt6.QtCore import QRunnable, pyqtSignal, pyqtSlot, QObject
from PyQt6.QtCore import QRunnable, QThread, pyqtSignal, pyqtSlot, QObject
import ctypes
import uldaq
import numpy as np
from IPython import embed
import traceback, sys
from pyrelacs.util.logging import config_logging from pyrelacs.util.logging import config_logging