Skip to content

Commit 1e70282

Browse files
authored
Updated some values. Removed AUTO.
1 parent d1e68be commit 1e70282

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

adafruit_ina219.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class Gain:
7171
DIV_2_80MV = 0x01 # shunt prog. gain set to /2, 80 mV range
7272
DIV_4_160MV = 0x02 # shunt prog. gain set to /4, 160 mV range
7373
DIV_8_320MV = 0x03 # shunt prog. gain set to /8, 320 mV range
74-
AUTO = -1 # shunt prog. gain set to automatic
7574

7675
class ADCResolution:
7776
"""Constants for ``bus_adc_resolution`` or ``shunt_adc_resolution``"""
@@ -484,12 +483,12 @@ def set_calibration_16V_5A(self):
484483
# only supporting 16V at 5000mA max.
485484

486485
# VBUS_MAX = 16V
487-
# VSHUNT_MAX = 0.08 (Assumes Gain 2, 80mV)
486+
# VSHUNT_MAX = 0.16 (Assumes Gain 3, 160mV)
488487
# RSHUNT = 0.02 (Resistor value in ohms)
489488

490489
# 1. Determine max possible current
491490
# MaxPossible_I = VSHUNT_MAX / RSHUNT
492-
# MaxPossible_I = 4.0A
491+
# MaxPossible_I = 8.0A
493492

494493
# 2. Determine max expected current
495494
# MaxExpected_I = 5.0A
@@ -513,7 +512,7 @@ def set_calibration_16V_5A(self):
513512

514513
# 6. Calculate the power LSB
515514
# PowerLSB = 20 * CurrentLSB
516-
# PowerLSB = 0.001 (1mW per bit)
515+
# PowerLSB = 0.003 (3.048mW per bit)
517516
self._power_lsb = 0.003048
518517

519518
# 7. Compute the maximum current and shunt voltage values before overflow
@@ -526,7 +525,7 @@ def set_calibration_16V_5A(self):
526525

527526
# Set Config register to take into account the settings above
528527
self.bus_voltage_range = BusVoltageRange.RANGE_16V
529-
self.gain = Gain.AUTO
528+
self.gain = Gain.DIV_4_160MV
530529
self.bus_adc_resolution = ADCResolution.ADCRES_12BIT_1S
531530
self.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_1S
532531
self.mode = Mode.SANDBVOLT_CONTINUOUS

0 commit comments

Comments
 (0)