Skip to content

Commit

Permalink
Update SI converstion
Browse files Browse the repository at this point in the history
Use equation (raw+offset)*scale for IIO property conversion

Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Dec 14, 2023
1 parent ca88175 commit 6387264
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions adi/rx_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ def __rx_unbuffered_data(self):

for samp in range(self.rx_buffer_size):
for i, m in enumerate(self.rx_enabled_channels):
s = self._get_iio_attr(
raw = self._get_iio_attr(
self._rx_channel_names[m], "raw", False, self._rxadc
)
if self._rx_output_type == "SI":
x[i][samp] = rx_scale[i] * s + rx_offset[i]
x[i][samp] = (raw + rx_offset[i]) * rx_scale[i]
else:
x[i][samp] = s
x[i][samp] = raw

return x

Expand Down Expand Up @@ -270,7 +270,7 @@ def __rx_non_complex(self):
rx_scale = self.__get_rx_channel_scales()
rx_offset = self.__get_rx_channel_offsets()
x = x if isinstance(x, list) else [x]
x = [rx_scale[i] * x[i] + rx_offset[i] for i in range(len(x))]
x = [rx_scale[i] * (x[i] + rx_offset[i]) for i in range(len(x))]
elif self._rx_output_type != "raw":
raise Exception("_rx_output_type undefined")

Expand Down

0 comments on commit 6387264

Please sign in to comment.