From 69fa77dfa7452b6dbb23601b83c210675d23308f Mon Sep 17 00:00:00 2001 From: Trisha De Vera Date: Wed, 28 Feb 2024 09:47:58 +0800 Subject: [PATCH] Fix tx conditions Signed-off-by: Trisha De Vera --- adi/rx_tx.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/adi/rx_tx.py b/adi/rx_tx.py index 5c1c59d67..2076bd1a8 100644 --- a/adi/rx_tx.py +++ b/adi/rx_tx.py @@ -381,15 +381,6 @@ def tx(self, data_np=None): Data must be complex when using a complex data device. """ - if not self._tx_data_type: - # Find channel data format - chan_name = self._tx_channel_names[self.tx_enabled_channels[0]] - chan = self._txdac.find_channel(chan_name, True) - df = chan.data_format - fmt = ("i" if df.is_signed is True else "u") + str(df.length // 8) - fmt = ">" + fmt if df.is_be else fmt - self._tx_data_type = np.dtype(fmt) - if not self.__tx_enabled_channels and data_np: raise Exception( "When tx_enabled_channels is None or empty," @@ -403,6 +394,15 @@ def tx(self, data_np=None): return raise Exception("No DDS channels found for TX, TX zeroing does not apply") + if not self._tx_data_type: + # Find channel data format + chan_name = self._tx_channel_names[self.tx_enabled_channels[0]] + chan = self._txdac.find_channel(chan_name, True) + df = chan.data_format + fmt = ("i" if df.is_signed is True else "u") + str(df.length // 8) + fmt = ">" + fmt if df.is_be else fmt + self._tx_data_type = np.dtype(fmt) + if self._txbuf and self.tx_cyclic_buffer: raise Exception( "TX buffer has been submitted in cyclic mode. "