From 9874aeb1d8c8ac01efe9ab134f717367a6dd7b68 Mon Sep 17 00:00:00 2001 From: Andrew Malota <2bitoperations@gmail.com> Date: Thu, 30 Nov 2017 20:05:16 -0600 Subject: [PATCH] another stupid oops --- lib/max31855spi.py | 4 ++++ lib/oven.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/max31855spi.py b/lib/max31855spi.py index 89182de..b3eb362 100644 --- a/lib/max31855spi.py +++ b/lib/max31855spi.py @@ -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']: diff --git a/lib/oven.py b/lib/oven.py index 8aca88d..23e4582 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -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: @@ -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)