- improved tempsensor exception
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import time
|
||||
from components import ATemperatureSensor
|
||||
from components import ATemperatureSensor, TemperatureSensorException
|
||||
import spidev
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ class TempSensor_max31865(ATemperatureSensor):
|
||||
lsb = self.read_reg(0x02)
|
||||
if lsb & 0x01 == 0x00:
|
||||
digits = (256*msb + lsb) >> 1
|
||||
else
|
||||
raise TemperatureSensorException("Could not read sensor!")
|
||||
|
||||
self.write_reg(0x00, 0xA3)
|
||||
return digits
|
||||
|
||||
Reference in New Issue
Block a user