Compare commits

...

3 Commits

Author SHA1 Message Date
wendtalexander
3766ea0ea2 Merge branch 'main' of https://whale.am28.uni-tuebingen.de/git/Awendt/pyrelacs 2024-09-18 15:27:32 +02:00
wendtalexander
e00259b15f removing imports 2024-09-18 15:26:01 +02:00
wendtalexander
e19c147059 adding threading to fix segementation fault 2024-09-18 15:25:18 +02:00
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)
buffer = ctypes.c_double * len(time)
buffer_ai = uldaq.create_float_buffer(1, len(time))
data_c = buffer(*data)
log.debug(f"Created C_double data {data_c}")
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(
0,
@@ -122,8 +137,11 @@ class PyRelacs(QMainWindow):
uldaq.AOutScanFlag.DEFAULT,
data_c,
)
while ao_device.get_scan_status()[0] == 1:
log.debug("Still running")
# INFO: Need to wait for the acquistion
self.daq_disconnect_button.setDisabled(True)
self.daq_connect_button.setEnabled(True)
embed()
exit()
if __name__ == "__main__":

View File

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