From ea4483977b3180d018b1c09426f8df40e582d192 Mon Sep 17 00:00:00 2001 From: "Bartosz M. Zabolotny" Date: Mon, 12 May 2025 19:05:39 +0200 Subject: [PATCH 1/2] INA3221 init: add probe parameter --- adafruit_ina3221.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adafruit_ina3221.py b/adafruit_ina3221.py index d81f68b..d3d7c9e 100644 --- a/adafruit_ina3221.py +++ b/adafruit_ina3221.py @@ -278,14 +278,15 @@ def summation_channel(self, value: bool) -> None: class INA3221: """Driver for the INA3221 device with three channels.""" - def __init__(self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2]) -> None: + def __init__(self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2], probe: bool = True) -> None: """Initializes the INA3221 class over I2C Args: i2c (I2C): The I2C bus to which the INA3221 is connected. address (int, optional): The I2C address of the INA3221. Defaults to DEFAULT_ADDRESS. enable(List[int], optional): channels to initialize at start (default: all) + probe (bool, optiona): Probe for the device upon object creation, default is true """ - self.i2c_dev = I2CDevice(i2c, address) + self.i2c_dev = I2CDevice(i2c, address, probe=probe) self.reset() self.channels: List[INA3221Channel] = [INA3221Channel(self, i) for i in range(3)] From c661e17a4d2cfe74badd419d2f4f93585865c8a8 Mon Sep 17 00:00:00 2001 From: "Bartosz M. Zabolotny" Date: Mon, 12 May 2025 22:56:57 +0200 Subject: [PATCH 2/2] Fix ruff error, line too long --- adafruit_ina3221.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_ina3221.py b/adafruit_ina3221.py index d3d7c9e..cff5474 100644 --- a/adafruit_ina3221.py +++ b/adafruit_ina3221.py @@ -278,7 +278,9 @@ def summation_channel(self, value: bool) -> None: class INA3221: """Driver for the INA3221 device with three channels.""" - def __init__(self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2], probe: bool = True) -> None: + def __init__( + self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2], probe: bool = True + ) -> None: """Initializes the INA3221 class over I2C Args: i2c (I2C): The I2C bus to which the INA3221 is connected.