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

Tries to fix "dict has no attr barrier" error

Showing with 31 additions and 27 deletions
+31 -27
...@@ -20,13 +20,13 @@ OHMPI_CONFIG = { ...@@ -20,13 +20,13 @@ OHMPI_CONFIG = {
HARDWARE_CONFIG = { HARDWARE_CONFIG = {
'ctl': {'model': 'raspberry_pi_i2c'}, 'ctl': {'model': 'raspberry_pi_i2c'},
'pwr': {'model': 'pwr_batt', 'voltage': 12.}, 'pwr': {'model': 'pwr_batt', 'voltage': 12.},
'tx' : {'model': 'ohmpi_card_3_15', 'tx': {'model': 'ohmpi_card_3_15',
'mcp_board_address': 0x20, 'mcp_board_address': 0x20,
'voltage_max': 12., # Maximum voltage supported by the TX board [V] 'voltage_max': 12., # Maximum voltage supported by the TX board [V]
'current_max': 4800 / 50 / 2, # Maximum current supported by the TX board [mA] 'current_max': 4800 / 50 / 2, # Maximum current supported by the TX board [mA]
'r_shunt': 2 # Shunt resistance in Ohms 'r_shunt': 2 # Shunt resistance in Ohms
}, },
'rx' : {'model': 'ohmpi_card_3_15', 'rx': {'model': 'ohmpi_card_3_15',
'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V 'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V
'sampling_rate': 10., # ms 'sampling_rate': 10., # ms
'nb_samples': 20, # Max value 10 # was named integer before... 'nb_samples': 20, # Max value 10 # was named integer before...
...@@ -34,27 +34,29 @@ HARDWARE_CONFIG = { ...@@ -34,27 +34,29 @@ HARDWARE_CONFIG = {
'mux': # default properties are system properties that will be 'mux': # default properties are system properties that will be
# overwritten by board properties defined at the board level within the board model file # overwritten by board properties defined at the board level within the board model file
# both will be overwritten by properties specified in the board dict below. Use with caution... # both will be overwritten by properties specified in the board dict below. Use with caution...
{'boards': {'boards':
{'mux_1': {'mux_1':
{'model': 'mux_2024_rev_0_0', # 'ohmpi_i2c_mux64_v1.01', {'model': 'mux_2024_rev_0_0', # 'ohmpi_i2c_mux64_v1.01',
'tca_address': None, 'tca_address': None,
'tca_channel': 0, 'tca_channel': 0,
'mcp_0': '0x22', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user... 'mcp_0': '0x22', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...
'mcp_1': '0x23', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) 'mcp_1': '0x23', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...)
'roles': {'A': 'X', 'B': 'Y', 'M' : 'XX', 'N' : 'YY'}, 'roles': {'A': 'X', 'B': 'Y', 'M' : 'XX', 'N' : 'YY'},
'channels': {(i, j): ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)}, 'channels': {(i, j): ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)},
'voltage_max': 12.}, 'voltage_max': 12.},
'mux_2': 'mux_2':
{'model': 'mux_2024_rev_0_0', # 'ohmpi_i2c_mux64_v1.01', {'model': 'mux_2024_rev_0_0', # 'ohmpi_i2c_mux64_v1.01',
'tca_address': None, 'tca_address': None,
'tca_channel': 0, 'tca_channel': 0,
'mcp_0': '0x23', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user... 'mcp_0': '0x23', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...
'mcp_1': '0x24', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) 'mcp_1': '0x24', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...)
'roles': {'A': 'X', 'B': 'Y', 'M' : 'XX', 'N' : 'YY'}, 'roles': {'A': 'X', 'B': 'Y', 'M' : 'XX', 'N' : 'YY'},
'channels': {(i+8, j): ('mux_2', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)}, 'channels': {(i+8, j): ('mux_2', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)},
'voltage_max': 12.} 'voltage_max': 12.}
}, },
'default': {'voltage_max': 100., 'current_max': 3.}} 'default': {'voltage_max': 100.,
'current_max': 3.}
}
} }
# SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS # SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS
......
...@@ -23,6 +23,7 @@ for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items(): ...@@ -23,6 +23,7 @@ for mux_id, mux_config in HARDWARE_CONFIG['mux']['boards'].items():
MUX_CONFIG[mux_id] = mux_module.MUX_CONFIG MUX_CONFIG[mux_id] = mux_module.MUX_CONFIG
MUX_CONFIG[mux_id].update(mux_config) MUX_CONFIG[mux_id].update(mux_config)
MUX_CONFIG[mux_id].update({'id': mux_id}) MUX_CONFIG[mux_id].update({'id': mux_id})
MUX_CONFIG[mux_id].update({'constructor': mux_module.Mux})
mux_boards.append(mux_id) mux_boards.append(mux_id)
TX_CONFIG = tx_module.TX_CONFIG TX_CONFIG = tx_module.TX_CONFIG
...@@ -77,7 +78,7 @@ class OhmPiHardware: ...@@ -77,7 +78,7 @@ class OhmPiHardware:
self.tx = kwargs.pop('tx', tx_module.Tx(**HARDWARE_CONFIG['tx'])) self.tx = kwargs.pop('tx', tx_module.Tx(**HARDWARE_CONFIG['tx']))
if isinstance(self.tx, dict): if isinstance(self.tx, dict):
self.tx = tx_module.Tx(**self.tx) self.tx = tx_module.Tx(**self.tx)
print(f'tx: {self.tx}, type: {type(self.tx)}') # TODO: Delete me! print(f'tx.Ctl: {self.tx.ctl}, type: {type(self.tx)}') # TODO: Delete me!
self.tx.pwr = self.pwr self.tx.pwr = self.pwr
self._cabling = kwargs.pop('cabling', {}) self._cabling = kwargs.pop('cabling', {})
......
...@@ -77,9 +77,10 @@ class OhmPi(object): ...@@ -77,9 +77,10 @@ class OhmPi(object):
print(msg) print(msg)
# read in hardware parameters (config.py) # read in hardware parameters (config.py)
HARDWARE_CONFIG.update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger, # HARDWARE_CONFIG.update({'exec_logger': self.exec_logger, 'data_logger': self.data_logger,
'soh_logger': self.soh_logger}) # 'soh_logger': self.soh_logger})
self._hw = OhmPiHardware(**HARDWARE_CONFIG) self._hw = OhmPiHardware(**{'exec_logger': self.exec_logger, 'data_logger': self.data_logger,
'soh_logger': self.soh_logger})
self.exec_logger.info('Hardware configured...') self.exec_logger.info('Hardware configured...')
# default acquisition settings # default acquisition settings
self.settings = { self.settings = {
......
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