Skip to content

Commit

Permalink
another stupid oops
Browse files Browse the repository at this point in the history
  • Loading branch information
2bitoperations committed Dec 1, 2017
1 parent 40bb54e commit 9874aeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/max31855spi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/python
import logging

from Adafruit_MAX31855 import MAX31855

class MAX31855SPI(object):
Expand All @@ -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']:
Expand Down
8 changes: 4 additions & 4 deletions lib/oven.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
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:
Expand Down Expand Up @@ -236,8 +236,8 @@ def run(self):
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)


Expand Down

0 comments on commit 9874aeb

Please sign in to comment.