Commit 1530193b authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Tries to fix "dict has no attribute bus" error

Showing with 3 additions and 3 deletions
+3 -3
...@@ -84,10 +84,11 @@ class Tx(TxAbstract): ...@@ -84,10 +84,11 @@ 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(**self.ctl)
# 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'])
# ADS1115 for current measurement (AB) # ADS1115 for current measurement (AB)
self._ads_current_address = 0x48 self._ads_current_address = 0x48
self._ads_current = ads.ADS1115(self.ctl.bus, gain=self.adc_gain, data_rate=860, self._ads_current = ads.ADS1115(self.ctl.bus, gain=self.adc_gain, data_rate=860,
...@@ -207,9 +208,8 @@ class Rx(RxAbstract): ...@@ -207,9 +208,8 @@ class Rx(RxAbstract):
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): elif isinstance(self.ctl, dict):
print(ctl_module)
self.ctl = ctl_module.Ctl(**self.ctl) self.ctl = ctl_module.Ctl(**self.ctl)
print(f'ctl: {self.ctl}, {type(self.ctl)}') # TODO: delete me! # print(f'ctl: {self.ctl}, {type(self.ctl)}') # TODO: delete me!
# ADS1115 for voltage measurement (MN) # ADS1115 for voltage measurement (MN)
self._ads_voltage_address = 0x49 self._ads_voltage_address = 0x49
self._adc_gain = 2/3 self._adc_gain = 2/3
......
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