From b4c2ec2c7e6e3af96a1c3cebb0f72a053e829901 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Tue, 2 May 2023 16:32:27 +0200 Subject: [PATCH] Fixes continuous mode in ohmpi_card_3_15 --- hardware_components/ohmpi_card_3_15.py | 3 +++ hardware_system.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hardware_components/ohmpi_card_3_15.py b/hardware_components/ohmpi_card_3_15.py index c9398a49..f1d905f4 100644 --- a/hardware_components/ohmpi_card_3_15.py +++ b/hardware_components/ohmpi_card_3_15.py @@ -2,6 +2,7 @@ import importlib from OhmPi.config import HARDWARE_CONFIG import adafruit_ads1x15.ads1115 as ads # noqa from adafruit_ads1x15.analog_in import AnalogIn # noqa +from adafruit_ads1x15.ads1x15 import Mode # noqa from adafruit_mcp230xx.mcp23008 import MCP23008 # noqa from digitalio import Direction # noqa import minimalmodbus # noqa @@ -83,6 +84,7 @@ class Tx(TxAbstract): self._ads_current_address = 0x48 self._ads_current = ads.ADS1115(self.controller.bus, gain=self.adc_gain, data_rate=860, address=self._ads_current_address) + self._ads_current.mode = Mode.CONTINUOUS # Relays for pulse polarity self.pin0 = self.mcp_board.get_pin(0) @@ -216,6 +218,7 @@ class Rx(RxAbstract): self._ads_voltage_address = 0x49 self._adc_gain = 2/3 self._ads_voltage = ads.ADS1115(self.controller.bus, gain=self._adc_gain, data_rate=860, address=self._ads_voltage_address) + self._ads_voltage.mode = Mode.CONTINUOUS self._sampling_rate = kwargs.pop('sampling_rate', sampling_rate) @property diff --git a/hardware_system.py b/hardware_system.py index 3d7a9039..7852284d 100644 --- a/hardware_system.py +++ b/hardware_system.py @@ -211,7 +211,7 @@ class OhmPiHardware: polarity = 1 return vab, polarity, rab - def vab_square_wave(self, vab, cycle_length, sampling_rate, cycles=3, polarity=1, append=False): + def vab_square_wave(self, vab, cycle_length, sampling_rate=None, cycles=3, polarity=1, append=False): self.tx.polarity = polarity lengths = [cycle_length/2]*2*cycles self._vab_pulses(vab, lengths, sampling_rate, append=append) -- GitLab