Skip to content

Commit

Permalink
Update AD7124 to support non-dashed channel names
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Nov 22, 2023
1 parent 9496ca6 commit 0e13595
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions adi/ad7124.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ def __init__(self, uri="", device_index=0):
else:
index += 1

# dynamically get channels and sorting them after the index of the first voltage channel
self._ctrl.channels.sort(key=lambda x: int(x.id[7 : x.id.find("-")]))
self._rx_channel_names = [chan.name for chan in self._ctrl.channels]
if "-" in self._rx_channel_names[0]:
self._rx_channel_names.sort(key=lambda x: int(x[7:].split("-")[0]))
else:
self._rx_channel_names.sort(key=lambda x: int(x[7:]))

for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
for name in self._rx_channel_names:
self.channel.append(self._channel(self._ctrl, name))
rx.__init__(self)

Expand Down

0 comments on commit 0e13595

Please sign in to comment.