From c5ce20ba9521cb65aec914fffabefecbc1c149d0 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Tue, 3 Oct 2023 22:36:57 +0200
Subject: [PATCH] Removes reference to tx_module.TX_CONFIG and
 rx_module.RX_CONFIG

---
 ohmpi/hardware_components/mb_2023_0_X.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ohmpi/hardware_components/mb_2023_0_X.py b/ohmpi/hardware_components/mb_2023_0_X.py
index 9d8e43b1..a51d631e 100644
--- a/ohmpi/hardware_components/mb_2023_0_X.py
+++ b/ohmpi/hardware_components/mb_2023_0_X.py
@@ -31,7 +31,7 @@ SPECS = {'rx': {'sampling_rate': {'min': 2., 'default': 10., 'max': 100.},
                 'adc_voltage_max': {'default': 4500.},
                 'voltage_max': {'min': 0., 'default': 12., 'max': 12.},
                 'data_rate': {'default': 860.},
-                'compatible_power_sources': {'default': ['pwr_batt', 'dps5005']},
+                'compatible_power_sources': {'default': 'pwr_batt', 'others' : ['dps5005']},
                 'r_shunt':  {'min': 0., 'default': 2. },
                 'activation_delay': {'default': 0.005},
                 'release_delay': {'default': 0.001},
@@ -114,8 +114,9 @@ class Tx(TxAbstract):
         kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
         super().__init__(**kwargs)
         assert isinstance(self.connection, I2C)
-        kwargs.update({'pwr': kwargs.pop('pwr', SPECS['tx']['compatible_power_sources'][0])})
-        if kwargs['pwr'] not in SPECS['tx']['compatible_power_sources']:
+        kwargs.update({'pwr': kwargs.pop('pwr', SPECS['tx']['compatible_power_sources']['default'])})
+        if (kwargs['pwr'] != SPECS['tx']['compatible_power_sources']['default']
+                and kwargs['pwr'] not in SPECS['tx']['compatible_power_sources']['other']):
             self.exec_logger.warning(f'Incompatible power source specified check config')
             assert kwargs['pwr'] in SPECS['tx']
         #self.pwr = None  # TODO: set a list of compatible power system with the tx
-- 
GitLab