kopia lustrzana https://github.com/jbruce12000/kiln-controller
another stupid oops
rodzic
40bb54e521
commit
9874aeb1d8
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
import logging
|
||||
|
||||
from Adafruit_MAX31855 import MAX31855
|
||||
|
||||
class MAX31855SPI(object):
|
||||
|
@ -9,10 +11,12 @@ class MAX31855SPI(object):
|
|||
'''
|
||||
def __init__(self, spi_dev):
|
||||
self.max31855 = MAX31855.MAX31855(spi=spi_dev)
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
def get(self):
|
||||
'''Reads SPI bus and returns current value of thermocouple.'''
|
||||
state = self.max31855.readState()
|
||||
self.log.debug("status %s" % state)
|
||||
if state['openCircuit']:
|
||||
raise MAX31855Error('Not Connected')
|
||||
elif state['shortGND']:
|
||||
|
|
|
@ -18,14 +18,14 @@ try:
|
|||
log.info("import MAX31855")
|
||||
if config.max31855spi:
|
||||
import Adafruit_GPIO.SPI as SPI
|
||||
from max6675 import MAX31855SPI, MAX31855SPIError
|
||||
from max31855spi import MAX31855SPI, MAX31855SPIError
|
||||
log.info("import MAX31855SPI")
|
||||
if config.max6675:
|
||||
from max6675 import MAX6675, MAX6675Error
|
||||
log.info("import MAX6675")
|
||||
sensor_available = True
|
||||
except ImportError:
|
||||
log.warning("Could not initialize temperature sensor, using dummy values!")
|
||||
log.exception("Could not initialize temperature sensor, using dummy values!")
|
||||
sensor_available = False
|
||||
|
||||
try:
|
||||
|
@ -236,8 +236,8 @@ class TempSensorReal(TempSensor):
|
|||
while True:
|
||||
try:
|
||||
self.temperature = self.thermocouple.get()
|
||||
except Exception as ex:
|
||||
log.error(ex, "problem reading temp")
|
||||
except Exception:
|
||||
log.exception("problem reading temp")
|
||||
time.sleep(self.time_step)
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue