another stupid oops

pull/1/head
Andrew Malota 2017-11-30 20:05:16 -06:00
rodzic 40bb54e521
commit 9874aeb1d8
2 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -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']:

Wyświetl plik

@ -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)