Commit 924d4a04 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Removes option in ohmpi_card_3_15 to create a ctl if ctl config is passed as a dict

Showing with 7 additions and 7 deletions
+7 -7
...@@ -48,6 +48,7 @@ TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', np.inf), ...@@ -48,6 +48,7 @@ TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', np.inf),
TX_CONFIG['mcp_board_address'] = TX_CONFIG.pop('mcp_board_address', tx_mcp_board_address) TX_CONFIG['mcp_board_address'] = TX_CONFIG.pop('mcp_board_address', tx_mcp_board_address)
TX_CONFIG['low_battery'] = TX_CONFIG.pop('low_battery', low_battery) TX_CONFIG['low_battery'] = TX_CONFIG.pop('low_battery', low_battery)
def _gain_auto(channel): def _gain_auto(channel):
"""Automatically sets the gain on a channel """Automatically sets the gain on a channel
...@@ -83,8 +84,6 @@ class Tx(TxAbstract): ...@@ -83,8 +84,6 @@ class Tx(TxAbstract):
self.current_adjustable = False self.current_adjustable = False
if self.ctl is None: if self.ctl is None:
self.ctl = ctl_module.Ctl() self.ctl = ctl_module.Ctl()
elif isinstance(self.ctl, dict):
self.ctl = ctl_module.Ctl(dict)
# I2C connexion to MCP23008, for current injection # I2C connexion to MCP23008, for current injection
self.mcp_board = MCP23008(self.ctl.bus, address=TX_CONFIG['mcp_board_address']) self.mcp_board = MCP23008(self.ctl.bus, address=TX_CONFIG['mcp_board_address'])
...@@ -207,8 +206,6 @@ class Rx(RxAbstract): ...@@ -207,8 +206,6 @@ class Rx(RxAbstract):
super().__init__(**kwargs) super().__init__(**kwargs)
if self.ctl is None: if self.ctl is None:
self.ctl = ctl_module.Ctl() self.ctl = ctl_module.Ctl()
elif isinstance(self.ctl, dict):
self.ctl = ctl_module.Ctl(dict)
# ADS1115 for voltage measurement (MN) # ADS1115 for voltage measurement (MN)
self._ads_voltage_address = 0x49 self._ads_voltage_address = 0x49
......
...@@ -5,6 +5,7 @@ import os ...@@ -5,6 +5,7 @@ import os
from ohmpi.utils import get_platform from ohmpi.utils import get_platform
from gpiozero import CPUTemperature # noqa from gpiozero import CPUTemperature # noqa
class Ctl(CtlAbstract): class Ctl(CtlAbstract):
def __init__(self, **kwargs): def __init__(self, **kwargs):
kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')}) kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
......
...@@ -50,9 +50,11 @@ class OhmPiHardware: ...@@ -50,9 +50,11 @@ class OhmPiHardware:
if self.soh_logger is None: if self.soh_logger is None:
self.soh_logger = create_stdout_logger('soh_hw') self.soh_logger = create_stdout_logger('soh_hw')
self.tx_sync = Event() self.tx_sync = Event()
self.ctl = kwargs.pop('ctl', ctl_module.Ctl(exec_logger=self.exec_logger, HARDWARE_CONFIG['ctl'].pop('model')
data_logger=self.data_logger, HARDWARE_CONFIG['ctl'].update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger,
soh_logger=self.soh_logger)) 'soh_logger': self.soh_logger})
self.ctl = kwargs.pop('ctl', ctl_module.Ctl(**HARDWARE_CONFIG['ctl']))
self.rx = kwargs.pop('rx', rx_module.Rx(exec_logger=self.exec_logger, self.rx = kwargs.pop('rx', rx_module.Rx(exec_logger=self.exec_logger,
data_logger=self.data_logger, data_logger=self.data_logger,
soh_logger=self.soh_logger, soh_logger=self.soh_logger,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment