diff --git a/dev/test_mb_2024_0_mux_2024.py b/dev/test_mb_2024_0_mux_2024.py index 1b2270d818a03ad6d05894700aea7266e2ab533a..aea5472e4fcee55d8939c54250576e00eb785544 100644 --- a/dev/test_mb_2024_0_mux_2024.py +++ b/dev/test_mb_2024_0_mux_2024.py @@ -7,9 +7,9 @@ import time import logging from ohmpi.config import HARDWARE_CONFIG -stand_alone = False # True +stand_alone = True part_of_hardware_system = False -within_ohmpi = True +within_ohmpi = False # Stand alone if stand_alone: diff --git a/ohmpi/hardware_components/mb_2023_0_X.py b/ohmpi/hardware_components/mb_2023_0_X.py index c7f03e056b9b0c776d6cad12ff7d7f156639a826..43772755b98d515166a2fb4ab8fbb6784c4d7392 100644 --- a/ohmpi/hardware_components/mb_2023_0_X.py +++ b/ohmpi/hardware_components/mb_2023_0_X.py @@ -74,7 +74,7 @@ class Tx(TxAbstract): subclass_init = True super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}\ttx_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}\ttx_init\tbegin\t{datetime.datetime.utcnow()}') assert isinstance(self.connection, I2C) kwargs.update({'pwr': kwargs.pop('pwr', SPECS['tx']['compatible_power_sources']['default'])}) if (kwargs['pwr'] != SPECS['tx']['compatible_power_sources']['default'] @@ -221,11 +221,9 @@ class Rx(RxAbstract): subclass_init = True super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}\trx_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}\trx_init\tbegin\t{datetime.datetime.utcnow()}') assert isinstance(self.connection, I2C) - self.exec_logger.event(f'{self.model}\trx_init\tbegin\t{datetime.datetime.utcnow()}') - # ADS1115 for voltage measurement (MN) self._ads_voltage_address = kwargs['ads_address'] self._adc_gain = 2/3 diff --git a/ohmpi/hardware_components/mb_2024_0_2.py b/ohmpi/hardware_components/mb_2024_0_2.py index 61472e2a7a1bd33c538c64ccb4f34336ddc8cc7f..5ba2ed86caa709d2ffb88cbc47ddb6ebdb99c3e4 100644 --- a/ohmpi/hardware_components/mb_2024_0_2.py +++ b/ohmpi/hardware_components/mb_2024_0_2.py @@ -74,7 +74,7 @@ class Tx(Tx_mb_2023): subclass_init = True super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}\ttx_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}\ttx_init\tbegin\t{datetime.datetime.utcnow()}') # Initialize LEDs self.pin4 = self.mcp_board.get_pin(4) # Ohmpi_run self.pin4.direction = Direction.OUTPUT @@ -102,7 +102,7 @@ class Rx(Rx_mb_2023): subclass_init = True super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}\trx_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}\trx_init\tbegin\t{datetime.datetime.utcnow()}') # I2C connection to MCP23008, for voltage self.mcp_board = MCP23008(self.connection, address=kwargs['mcp_address']) # ADS1115 for voltage measurement (MN) diff --git a/ohmpi/hardware_components/mux_2023_0_X.py b/ohmpi/hardware_components/mux_2023_0_X.py index b3fd4247f2f41945d5af44b45f4a164a64470d2b..140ab1805265f70a6f328c45def2908d41273e55 100644 --- a/ohmpi/hardware_components/mux_2023_0_X.py +++ b/ohmpi/hardware_components/mux_2023_0_X.py @@ -68,7 +68,7 @@ class Mux(MuxAbstract): kwargs.update({'cabling': kwargs.pop('cabling', default_mux_cabling)}) super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}{self.board_id}\tmux_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}{self.board_id}\tmux_init\tbegin\t{datetime.datetime.utcnow()}') assert isinstance(self.connection, I2C) self.exec_logger.debug(f'configuration: {kwargs}') self._roles = kwargs.pop('roles', None) diff --git a/ohmpi/hardware_components/mux_2024_0_X.py b/ohmpi/hardware_components/mux_2024_0_X.py index f6e642a9d03222ab6bb62e818b299e67a7f39ae9..c7cfce2c3232d96ced942b544791a43881b83847 100644 --- a/ohmpi/hardware_components/mux_2024_0_X.py +++ b/ohmpi/hardware_components/mux_2024_0_X.py @@ -66,7 +66,7 @@ class Mux(MuxAbstract): subclass_init = True super().__init__(**kwargs) if not subclass_init: - self.exec_logger.event(f'{self.model}{self.board_id}\tmux_init\tstart\t{datetime.datetime.utcnow()}') + self.exec_logger.event(f'{self.model}{self.board_id}\tmux_init\tbegin\t{datetime.datetime.utcnow()}') assert isinstance(self.connection, I2C) self.exec_logger.debug(f'configuration: {kwargs}') tca_address = kwargs.pop('tca_address', None) diff --git a/ohmpi/hardware_components/pwr_batt.py b/ohmpi/hardware_components/pwr_batt.py index 614e4fdefd00e04e16da67b368f8030c80ea3a3c..c949675b8770aac86d834a82256157de9c453665 100644 --- a/ohmpi/hardware_components/pwr_batt.py +++ b/ohmpi/hardware_components/pwr_batt.py @@ -5,7 +5,7 @@ import os class Pwr(PwrAbstract): def __init__(self, **kwargs): - kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')}) + kwargs.update({'model': os.path.basename(__file__).rstrip('.py')}) voltage = kwargs.pop('voltage', 12.) super().__init__(**kwargs) self.voltage_adjustable = False diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py index 50a92e43ac3e075dfa78c52076ac9d811802470d..b1cd7180bebeb5a5c60bb19b8100f96030de14b1 100644 --- a/ohmpi/hardware_components/pwr_dps5005.py +++ b/ohmpi/hardware_components/pwr_dps5005.py @@ -11,6 +11,8 @@ SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'current_max': {'default': 100.}, } +# TODO: Complete this code... handle modbus connection + class Pwr(PwrAbstract): def __init__(self, **kwargs): @@ -20,9 +22,9 @@ class Pwr(PwrAbstract): subclass_init = False else: subclass_init = True + super().__init__(**kwargs) if not subclass_init: self.exec_logger.event(f'{self.model}\tpwr_init\tstart\t{datetime.datetime.utcnow()}') - super().__init__(**kwargs) # if a controller is passed in kwargs, it will be instantiated #if self.ctl is None: # self.ctl = ctl_module.Ctl(**CTL_CONFIG)