Skip to content

Commit 74ed904

Browse files
committed
Add HALLCONF=0x0 calibration data to _LSB_LOOKUP
Changed _LSB_LOOKUP to be a 4d array by adding a second set of calibration data for HALLCONF = 0x0 as per existing Arduino library: _LSB_LOOKUP[0][x][y][z] is for HALLCONF = 0xC _LSB_LOOKUP[1][x][y][z] is for HALLCONF = 0x0 Verified calibration values as per most current datasheet (rev. 6)
1 parent 9a0d067 commit 74ed904

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

adafruit_mlx90393.py

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,44 @@
102102
# coefficient below. Note that the z axis has a different coefficient
103103
# than the x and y axis. Assumes HALLCONF = 0x0C!
104104
_LSB_LOOKUP = (
105-
# 5x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
106-
((0.751, 1.210), (1.502, 2.420), (3.004, 4.840), (6.009, 9.680)),
107-
# 4x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
108-
((0.601, 0.968), (1.202, 1.936), (2.403, 3.872), (4.840, 7.744)),
109-
# 3x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
110-
((0.451, 0.726), (0.901, 1.452), (1.803, 2.904), (3.605, 5.808)),
111-
# 2.5x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
112-
((0.376, 0.605), (0.751, 1.210), (1.502, 2.420), (3.004, 4.840)),
113-
# 2x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
114-
((0.300, 0.484), (0.601, 0.968), (1.202, 1.936), (2.403, 3.872)),
115-
# 1.667x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
116-
((0.250, 0.403), (0.501, 0.807), (1.001, 1.613), (2.003, 3.227)),
117-
# 1.333x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
118-
((0.200, 0.323), (0.401, 0.645), (0.801, 1.291), (1.602, 2.581)),
119-
# 1x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
120-
((0.150, 0.242), (0.300, 0.484), (0.601, 0.968), (1.202, 1.936)),
105+
# HALLCONF = 0xC (default)
106+
(
107+
# 5x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
108+
((0.751, 1.210), (1.502, 2.420), (3.004, 4.840), (6.009, 9.680)),
109+
# 4x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
110+
((0.601, 0.968), (1.202, 1.936), (2.403, 3.872), (4.840, 7.744)),
111+
# 3x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
112+
((0.451, 0.726), (0.901, 1.452), (1.803, 2.904), (3.605, 5.808)),
113+
# 2.5x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
114+
((0.376, 0.605), (0.751, 1.210), (1.502, 2.420), (3.004, 4.840)),
115+
# 2x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
116+
((0.300, 0.484), (0.601, 0.968), (1.202, 1.936), (2.403, 3.872)),
117+
# 1.667x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
118+
((0.250, 0.403), (0.501, 0.807), (1.001, 1.613), (2.003, 3.227)),
119+
# 1.333x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
120+
((0.200, 0.323), (0.401, 0.645), (0.801, 1.291), (1.602, 2.581)),
121+
# 1x gain: res0(xy)(z), res1(xy)(z), res2(xy)(z), res3(xy)(z)
122+
((0.150, 0.242), (0.300, 0.484), (0.601, 0.968), (1.202, 1.936)),
123+
),
124+
# HALLCONF = 0x0
125+
(
126+
# GAIN_SEL = 0, 5x gain
127+
((0.787, 1.267), (1.573, 2.534), (3.146, 5.068), (6.292, 10.137)),
128+
# GAIN_SEL = 1, 4x gain
129+
((0.629, 1.014), (1.258, 2.027), (2.517, 4.055), (5.034, 8.109)),
130+
# GAIN_SEL = 2, 3x gain
131+
((0.472, 0.760), (0.944, 1.521), (1.888, 3.041), (3.775, 6.082)),
132+
# GAIN_SEL = 3, 2.5x gain
133+
((0.393, 0.634), (0.787, 1.267), (1.573, 2.534), (3.146, 5.068)),
134+
# GAIN_SEL = 4, 2x gain
135+
((0.315, 0.507), (0.629, 1.014), (1.258, 2.027), (2.517, 4.055)),
136+
# GAIN_SEL = 5, 1.667x gain
137+
((0.262, 0.422), (0.524, 0.845), (1.049, 1.689), (2.097, 3.379)),
138+
# GAIN_SEL = 6, 1.333x gain
139+
((0.210, 0.338), (0.419, 0.676), (0.839, 1.352), (1.678, 2.703)),
140+
# GAIN_SEL = 7, 1x gain
141+
((0.157, 0.253), (0.315, 0.507), (0.629, 1.014), (1.258, 2.027)),
142+
),
121143
)
122144

123145
# Lookup table for conversion times for different filter and

0 commit comments

Comments
 (0)