From ebc9b124e32a15920124a65f35390cb7aaf80598 Mon Sep 17 00:00:00 2001
From: awatlet <arnaud.watlet@umons.ac.be>
Date: Thu, 12 Oct 2023 09:05:53 +0200
Subject: [PATCH] Adds jumper positions capability for mux_2024 config

---
 ohmpi/hardware_components/mux_2024_0_X.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ohmpi/hardware_components/mux_2024_0_X.py b/ohmpi/hardware_components/mux_2024_0_X.py
index a865b372..49c528a1 100644
--- a/ohmpi/hardware_components/mux_2024_0_X.py
+++ b/ohmpi/hardware_components/mux_2024_0_X.py
@@ -100,7 +100,7 @@ class Mux(MuxAbstract):
                 self.exec_logger.debug(f'MCP addresses nor jumper positions for {self.board_id} not in config file...')
                 # TODO: if no addresses defined, should abort or should we set default mcp addresses?
         for addr in self._mcp_addresses:
-            assert addr in [0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27]
+            assert addr in ['0x20', '0x21', '0x22', '0x23', '0x24', '0x25', '0x26', '0x27']
         self._mcp = [None, None]
         self.reset()
 
@@ -142,6 +142,6 @@ class Mux(MuxAbstract):
 
     def _mcp_jumper_pos_to_addr(self):
         d = {'up': 0, 'down': 1}
-        mcp_0 = int(f"0100{d[self._mcp_jumper_pos['addr2']]}{d[self._mcp_jumper_pos['addr1']]}0", 2)
-        mcp_1 = int(f"0100{d[self._mcp_jumper_pos['addr2']]}{d[self._mcp_jumper_pos['addr1']]}1", 2)
+        mcp_0 = hex(int(f"0100{d[self._mcp_jumper_pos['addr2']]}{d[self._mcp_jumper_pos['addr1']]}0", 2))
+        mcp_1 = hex(int(f"0100{d[self._mcp_jumper_pos['addr2']]}{d[self._mcp_jumper_pos['addr1']]}1", 2))
         self._mcp_addresses = (mcp_0, mcp_1)
\ No newline at end of file
-- 
GitLab