Commit a703c3a9 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Tries to implement switch_on in mux_2024

Showing with 12 additions and 8 deletions
+12 -8
...@@ -46,15 +46,9 @@ class MuxAbstract(ABC): ...@@ -46,15 +46,9 @@ class MuxAbstract(ABC):
self.controller = kwargs.pop('controller', None) self.controller = kwargs.pop('controller', None)
self.addresses = kwargs.pop('addresses', None) self.addresses = kwargs.pop('addresses', None)
@abstractmethod
def _get_addresses(self, addresses_file): def _get_addresses(self, addresses_file):
with open(addresses_file, 'r') as f: pass
x = json.load(f)
self.addresses = {}
for k in x.keys():
y = k.strip('(').strip(')').split(', ')
x[k]['TCA']
self.addresses.update({(int(y[0]), y[1]): x[k]})
@abstractmethod @abstractmethod
def reset(self): def reset(self):
......
from OhmPi.config import HARDWARE_CONFIG from OhmPi.config import HARDWARE_CONFIG
import os import os
import json
from OhmPi.hardware_components import MuxAbstract from OhmPi.hardware_components import MuxAbstract
import adafruit_tca9548a # noqa import adafruit_tca9548a # noqa
from adafruit_mcp230xx.mcp23017 import MCP23017 # noqa from adafruit_mcp230xx.mcp23017 import MCP23017 # noqa
...@@ -17,6 +18,15 @@ class Mux(MuxAbstract): ...@@ -17,6 +18,15 @@ class Mux(MuxAbstract):
self._get_addresses(MUX_CONFIG['addresses']) self._get_addresses(MUX_CONFIG['addresses'])
self.exec_logger.debug(f'Using {MUX_CONFIG["addresses"]} for {self.board_name}...') self.exec_logger.debug(f'Using {MUX_CONFIG["addresses"]} for {self.board_name}...')
def _get_addresses(self, addresses_file):
with open(addresses_file, 'r') as f:
x = json.load(f)
self.addresses = {}
for k in x.keys():
y = k.strip('(').strip(')').split(', ')
self.addresses.update({(int(y[0]), y[1]): x[k]})
def reset(self): def reset(self):
pass pass
......
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