Skip to content

Commit

Permalink
Merge pull request #537 from trishaange01/rx_tx
Browse files Browse the repository at this point in the history
Fix tx_enabled_channel condition order
  • Loading branch information
tfcollins authored Mar 8, 2024
2 parents 1233cf8 + 69fa77d commit b5da485
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions adi/rx_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,"
Expand All @@ -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. "
Expand Down

0 comments on commit b5da485

Please sign in to comment.