Commit b7224df3 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Updates components for tests

Showing with 36 additions and 31 deletions
+36 -31
...@@ -89,25 +89,28 @@ class Tx(TxAbstract): ...@@ -89,25 +89,28 @@ class Tx(TxAbstract):
# I2C connexion to MCP23008, for current injection # I2C connexion to MCP23008, for current injection
self._mcp_address = kwargs['mcp_address'] self._mcp_address = kwargs['mcp_address']
self.reset_mcp() if self.connect:
self.reset_mcp()
# ADS1115 for current measurement (AB) # ADS1115 for current measurement (AB)
self._ads_current_address = kwargs['ads_address'] self._ads_current_address = kwargs['ads_address']
self._ads_current_data_rate = kwargs['data_rate'] self._ads_current_data_rate = kwargs['data_rate']
self._adc_gain = 2 / 3 self._adc_gain = 2 / 3
self.reset_ads() if self.connect:
self.reset_ads()
self._ads_current.mode = Mode.CONTINUOUS
self._ads_current.mode = Mode.CONTINUOUS
self._r_shunt = kwargs['r_shunt'] self._r_shunt = kwargs['r_shunt']
self.adc_voltage_min = kwargs['adc_voltage_min'] self.adc_voltage_min = kwargs['adc_voltage_min']
self.adc_voltage_max = kwargs['adc_voltage_max'] self.adc_voltage_max = kwargs['adc_voltage_max']
# Relays for pulse polarity # Relays for pulse polarity
self.pin0 = self.mcp_board.get_pin(0) if self.connect:
self.pin0.direction = Direction.OUTPUT self.pin0 = self.mcp_board.get_pin(0)
self.pin1 = self.mcp_board.get_pin(1) self.pin0.direction = Direction.OUTPUT
self.pin1.direction = Direction.OUTPUT self.pin1 = self.mcp_board.get_pin(1)
self.polarity = 0 self.pin1.direction = Direction.OUTPUT
self.gain = 2 / 3 self.polarity = 0
self.gain = 2 / 3
if not subclass_init: if not subclass_init:
self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}')
......
...@@ -82,18 +82,19 @@ class Tx(Tx_mb_2023): ...@@ -82,18 +82,19 @@ class Tx(Tx_mb_2023):
self._pwr_latency = kwargs['pwr_latency'] self._pwr_latency = kwargs['pwr_latency']
# Initialize LEDs # Initialize LEDs
self.pin4 = self.mcp_board.get_pin(4) # Ohmpi_run if self.connect:
self.pin4.direction = Direction.OUTPUT self.pin4 = self.mcp_board.get_pin(4) # Ohmpi_run
self.pin4.value = True self.pin4.direction = Direction.OUTPUT
self.pin6 = self.mcp_board.get_pin(6) self.pin4.value = True
self.pin6.direction = Direction.OUTPUT self.pin6 = self.mcp_board.get_pin(6)
self.pin6.value = False self.pin6.direction = Direction.OUTPUT
self.pin2 = self.mcp_board.get_pin(2) # dps - self.pin6.value = False
self.pin2.direction = Direction.OUTPUT self.pin2 = self.mcp_board.get_pin(2) # dps -
self.pin2.value = False self.pin2.direction = Direction.OUTPUT
self.pin3 = self.mcp_board.get_pin(3) # dps - self.pin2.value = False
self.pin3.direction = Direction.OUTPUT self.pin3 = self.mcp_board.get_pin(3) # dps -
self.pin3.value = False self.pin3.direction = Direction.OUTPUT
self.pin3.value = False
if not subclass_init: if not subclass_init:
self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}')
...@@ -151,16 +152,17 @@ class Rx(Rx_mb_2023): ...@@ -151,16 +152,17 @@ class Rx(Rx_mb_2023):
self._dg411_gain = self._dg411_gain_ratio self._dg411_gain = self._dg411_gain_ratio
# Define pins for DG411 # Define pins for DG411
self.pin_DG0 = self.mcp_board.get_pin(0) if self.connect:
self.pin_DG0.direction = Direction.OUTPUT self.pin_DG0 = self.mcp_board.get_pin(0)
self.pin_DG1 = self.mcp_board.get_pin(1) self.pin_DG0.direction = Direction.OUTPUT
self.pin_DG1.direction = Direction.OUTPUT self.pin_DG1 = self.mcp_board.get_pin(1)
self.pin_DG2 = self.mcp_board.get_pin(2) self.pin_DG1.direction = Direction.OUTPUT
self.pin_DG2.direction = Direction.OUTPUT self.pin_DG2 = self.mcp_board.get_pin(2)
self.pin_DG0.value = True # open self.pin_DG2.direction = Direction.OUTPUT
self.pin_DG1.value = True # open gain 1 inactive self.pin_DG0.value = True # open
self.pin_DG2.value = False # close gain 0.5 active self.pin_DG1.value = True # open gain 1 inactive
self.gain = 1/3 self.pin_DG2.value = False # close gain 0.5 active
self.gain = 1/3
if not subclass_init: # TODO: try to only log this event and not the one created by super() if not subclass_init: # TODO: try to only log this event and not the one created by super()
self.exec_logger.event(f'{self.model}\trx_init\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.model}\trx_init\tend\t{datetime.datetime.utcnow()}')
......
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