Commit 3ca8c387 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Removes reference to tx_module.TX_CONFIG and rx_module.RX_CONFIG

Showing with 8 additions and 5 deletions
+8 -5
...@@ -144,7 +144,7 @@ class Tx(TxAbstract): ...@@ -144,7 +144,7 @@ class Tx(TxAbstract):
self.pin1 = self.mcp_board.get_pin(1) self.pin1 = self.mcp_board.get_pin(1)
self.pin1.direction = Direction.OUTPUT self.pin1.direction = Direction.OUTPUT
self.polarity = 0 self.polarity = 0
self.adc_gain = 2 / 3 self.gain = 2 / 3
# MCP23008 pins for LEDs # MCP23008 pins for LEDs
self.pin4 = self.mcp_board.get_pin(4) # TODO: Delete me? No LED on this version of the board self.pin4 = self.mcp_board.get_pin(4) # TODO: Delete me? No LED on this version of the board
...@@ -154,11 +154,11 @@ class Tx(TxAbstract): ...@@ -154,11 +154,11 @@ class Tx(TxAbstract):
self.exec_logger.event(f'{self.board_name}\ttx_init\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.board_name}\ttx_init\tend\t{datetime.datetime.utcnow()}')
@property @property
def adc_gain(self): def gain(self):
return self._adc_gain return self._adc_gain
@adc_gain.setter @gain.setter
def adc_gain(self, value): def gain(self, value):
assert value in [2/3, 2, 4, 8, 16] assert value in [2/3, 2, 4, 8, 16]
self._adc_gain = value self._adc_gain = value
self._ads_current = ads.ADS1115(self.connection, gain=self.adc_gain, self._ads_current = ads.ADS1115(self.connection, gain=self.adc_gain,
...@@ -171,7 +171,7 @@ class Tx(TxAbstract): ...@@ -171,7 +171,7 @@ class Tx(TxAbstract):
self.exec_logger.event(f'{self.board_name}\ttx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.board_name}\ttx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}')
gain = _gain_auto(AnalogIn(self._ads_current, ads.P0)) gain = _gain_auto(AnalogIn(self._ads_current, ads.P0))
self.exec_logger.debug(f'Setting TX ADC gain automatically to {gain}') self.exec_logger.debug(f'Setting TX ADC gain automatically to {gain}')
self.adc_gain = gain self.gain = gain
self.exec_logger.event(f'{self.board_name}\ttx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.board_name}\ttx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}')
def current_pulse(self, **kwargs): def current_pulse(self, **kwargs):
......
...@@ -173,11 +173,14 @@ class OhmPiHardware: ...@@ -173,11 +173,14 @@ class OhmPiHardware:
def _gain_auto(self, polarities=(1, -1)): # TODO: improve _gain_auto def _gain_auto(self, polarities=(1, -1)): # TODO: improve _gain_auto
self.exec_logger.event(f'OhmPiHardware\ttx_rx_gain_auto\tbegin\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'OhmPiHardware\ttx_rx_gain_auto\tbegin\t{datetime.datetime.utcnow()}')
current, voltage = 0., 0. current, voltage = 0., 0.
gains = []
for pol in polarities: for pol in polarities:
self.tx.polarity = pol self.tx.polarity = pol
# self.tx_sync.wait() # self.tx_sync.wait()
# set gains automatically # set gains automatically
injection = Thread(target=self._inject, kwargs={'injection_duration': 0.2, 'polarity': pol}) injection = Thread(target=self._inject, kwargs={'injection_duration': 0.2, 'polarity': pol})
self.tx.gain_auto()
gains.append(self.tx.gain)
readings = Thread(target=self._read_values) readings = Thread(target=self._read_values)
readings.start() readings.start()
injection.start() injection.start()
......
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