trying to fix seg fault

This commit is contained in:
wendtalexander 2024-09-25 15:31:15 +02:00
parent deb60fa84c
commit 1a2185d5e4
2 changed files with 21 additions and 20 deletions

View File

@ -50,12 +50,12 @@ class Calibration(MccDac):
# sending stimulus # sending stimulus
log.debug(f"{data}, {data.shape}") log.debug(f"{data}, {data.shape}")
embed()
exit()
# self.set_attenuation_level(db_channel1=0.0, db_channel2=0.0) # self.set_attenuation_level(db_channel1=0.0, db_channel2=0.0)
# self.set_analog_to_zero() # self.set_analog_to_zero()
# time.sleep(1) # time.sleep(1)
log.debug(self.ao_device) log.debug(self.ao_device)
embed()
exit()
self.write_analog( self.write_analog(
data, data,

View File

@ -95,23 +95,23 @@ class MccDac:
log.debug(f"Created C_double data {data_analog_output}") log.debug(f"Created C_double data {data_analog_output}")
log.info(self.ao_device) log.info(self.ao_device)
try:
err = self.ao_device.a_out_scan( err = self.ao_device.a_out_scan(
channels[0], channels[0],
channels[1], channels[1],
Range, Range,
int(len(data)), int(len(data)),
samplerate, samplerate,
ScanOption, ScanOption,
AOutScanFlag, AOutScanFlag,
data_analog_output, data_analog_output,
) )
# self.diggital_trigger() # self.diggital_trigger()
# self.ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 11) # self.ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 11)
except Exception as e: # except Exception as e:
print(f"{e}") # print(f"{e}")
self.set_analog_to_zero() # self.set_analog_to_zero()
self.disconnect_dac() # self.disconnect_dac()
def set_analog_to_zero(self, channels: list[int] = [0, 1]): def set_analog_to_zero(self, channels: list[int] = [0, 1]):
try: try:
@ -132,11 +132,12 @@ class MccDac:
def diggital_trigger(self, channel: int = 0) -> None: def diggital_trigger(self, channel: int = 0) -> None:
bit_channel = self.read_bit(channel) bit_channel = self.read_bit(channel)
log.debug(bit_channel)
if not bit_channel: if not bit_channel:
self.write_bit(channel, 1) self.write_bit(channel, 1)
else: else:
self.write_bit(channel, 0) self.write_bit(channel, 0)
time.time_ns() time.sleep(1)
self.write_bit(channel, 1) self.write_bit(channel, 1)
def write_bit(self, channel: int = 0, bit: int = 1) -> None: def write_bit(self, channel: int = 0, bit: int = 1) -> None: