From b19e65b8afcbbc1ca3790477ef9ab39a4cbba753 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Fri, 22 Sep 2023 17:12:51 +0200
Subject: [PATCH] Modifies the way a controller is used by defining several
 connections and adding an io to components

---
 ohmpi/hardware_components/ohmpi_card_3_15.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ohmpi/hardware_components/ohmpi_card_3_15.py b/ohmpi/hardware_components/ohmpi_card_3_15.py
index d8a63edf..643ed23a 100644
--- a/ohmpi/hardware_components/ohmpi_card_3_15.py
+++ b/ohmpi/hardware_components/ohmpi_card_3_15.py
@@ -96,7 +96,7 @@ class Tx(TxAbstract):
             self.ctl = ctl_module.Ctl()
         # elif isinstance(self.ctl, dict):
         #     self.ctl = ctl_module.Ctl(**self.ctl)
-        self.io = self.ctl[kwargs.pop('connection', ctl_connection)]
+        self.io = self.ctl.connections[kwargs.pop('connection', ctl_connection)]
 
         # I2C connexion to MCP23008, for current injection
         self.mcp_board = MCP23008(self.io, address=TX_CONFIG['mcp_board_address'])
@@ -228,7 +228,7 @@ class Rx(RxAbstract):
         self.exec_logger.event(f'{self.board_name}\trx_init\tbegin\t{datetime.datetime.utcnow()}')
         if self.ctl is None:
             self.ctl = ctl_module.Ctl()
-        self.io = self.ctl[kwargs.pop('connection', ctl_connection)]
+        self.io = self.ctl.connections[kwargs.pop('connection', ctl_connection)]
 
         # ADS1115 for voltage measurement (MN)
         self._ads_voltage_address = 0x49
-- 
GitLab