diff --git a/ohmpi/hardware_components/mb_2023_0_X.py b/ohmpi/hardware_components/mb_2023_0_X.py index ab23d29c13f7e6cd61803e283ab4dcb8712bdd55..48849b9c35855ab3c0f95a34ddba6560bd969b82 100644 --- a/ohmpi/hardware_components/mb_2023_0_X.py +++ b/ohmpi/hardware_components/mb_2023_0_X.py @@ -247,9 +247,7 @@ class Rx(RxAbstract): def _adc_gain_auto(self): self.exec_logger.event(f'{self.board_name}\trx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}') - gain_0 = _ads_1115_gain_auto(AnalogIn(self._ads_voltage, ads.P0)) - gain_2 = _ads_1115_gain_auto(AnalogIn(self._ads_voltage, ads.P2)) - gain = np.min([gain_0, gain_2]) + gain = _ads_1115_gain_auto(AnalogIn(self._ads_voltage, ads.P0, ads.P1)) self.exec_logger.debug(f'Setting RX ADC gain automatically to {gain}') self.gain = gain self.exec_logger.event(f'{self.board_name}\trx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}') diff --git a/ohmpi/hardware_components/mb_2024_0_2.py b/ohmpi/hardware_components/mb_2024_0_2.py index f318c54df9b0804aa73900aa0cd351da0e0b94c9..9bb65d72ac37d8041f043afcc6c3d3b48132d1de 100644 --- a/ohmpi/hardware_components/mb_2024_0_2.py +++ b/ohmpi/hardware_components/mb_2024_0_2.py @@ -105,6 +105,13 @@ class Rx(Rx_mb_2023): # TODO: try to only log this event and not the one created by super() self.exec_logger.event(f'{self.board_name}\trx_init\tend\t{datetime.datetime.utcnow()}') + def _adc_gain_auto(self): + self.exec_logger.event(f'{self.board_name}\trx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}') + gain = _ads_1115_gain_auto(AnalogIn(self._ads_voltage, ads.P0)) + self.exec_logger.debug(f'Setting RX ADC gain automatically to {gain}') + self.gain = gain + self.exec_logger.event(f'{self.board_name}\trx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}') + def _dg411_gain_auto(self): if self.voltage < self._vmn_hardware_offset : self._dg411_gain = 1.