Skip to content

Commit eb8e72c

Browse files
authored
Merge pull request #32 from emmanuelthome/enable_auto_convert
auto_convert: set/unset bias, + use in read_rtd
2 parents d0cfb9b + 6bf5b78 commit eb8e72c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

adafruit_max31865.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ def auto_convert(self, val):
204204
config = self._read_u8(_MAX31865_CONFIG_REG)
205205
if val:
206206
config |= _MAX31865_CONFIG_MODEAUTO # Enable auto convert.
207+
config |= _MAX31865_CONFIG_BIAS # Enable bias.
207208
else:
208209
config &= ~_MAX31865_CONFIG_MODEAUTO # Disable auto convert.
210+
config &= ~_MAX31865_CONFIG_BIAS # Disable bias.
209211
self._write_u8(_MAX31865_CONFIG_REG, config)
210212

211213
@property
@@ -243,6 +245,11 @@ def read_rtd(self):
243245
nominal value of the resistance-to-digital conversion and some math. If you just want
244246
temperature use the temperature property instead.
245247
"""
248+
if self.auto_convert:
249+
rtd = self._read_u16(_MAX31865_RTDMSB_REG)
250+
if not rtd & 1:
251+
rtd >>= 1
252+
return rtd
246253
self.clear_faults()
247254
self.bias = True
248255
time.sleep(0.01)

0 commit comments

Comments
 (0)