Initial work on display
This commit is contained in:
parent
19c233c228
commit
8de864a5b3
@ -119,7 +119,7 @@ class MAX31856(object):
|
||||
# Handle hardware SPI
|
||||
if hardware_spi is not None:
|
||||
self._logger.debug('Using hardware SPI')
|
||||
self._spi = hardware_spi
|
||||
self._spi = SPI.SpiDev(hardware_spi['port'], hardware_spi['device'])
|
||||
elif software_spi is not None:
|
||||
self._logger.debug('Using software SPI')
|
||||
# Default to platform GPIO if not provided.
|
||||
|
||||
18
lib/oven.py
18
lib/oven.py
@ -133,12 +133,22 @@ class TempSensorReal(TempSensor):
|
||||
if config.max31856:
|
||||
log.info("init MAX31856")
|
||||
from max31856 import MAX31856
|
||||
software_spi = { 'cs': config.gpio_sensor_cs,
|
||||
'clk': config.gpio_sensor_clock,
|
||||
'do': config.gpio_sensor_data,
|
||||
'di': config.gpio_sensor_di }
|
||||
if config.gpio_spi:
|
||||
log.info("using software SPI")
|
||||
software_spi = {'cs': config.gpio_sensor_cs,
|
||||
'clk': config.gpio_sensor_clock,
|
||||
'do': config.gpio_sensor_data,
|
||||
'di': config.gpio_sensor_di }
|
||||
hardware_spi = None
|
||||
else:
|
||||
log.info("using hardware SPI")
|
||||
software_spi = None
|
||||
hardware_spi = {'port': config.spi_port,
|
||||
'device': config.spi_device}
|
||||
|
||||
self.thermocouple = MAX31856(tc_type=config.thermocouple_type,
|
||||
software_spi = software_spi,
|
||||
hardware_spi = hardware_spi,
|
||||
units = config.temp_scale,
|
||||
ac_freq_50hz = config.ac_freq_50hz,
|
||||
)
|
||||
|
||||
35
lib/ovenDisplay.py
Normal file
35
lib/ovenDisplay.py
Normal file
@ -0,0 +1,35 @@
|
||||
import threading,logging,json,time,datetime
|
||||
from oven import Oven
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class OvenDisplay(threading.Thread):
|
||||
def __init__(self,oven,ovenWatcher):
|
||||
self.last_profile = None
|
||||
self.last_log = []
|
||||
self.started = None
|
||||
self.recording = False
|
||||
self.observers = []
|
||||
threading.Thread.__init__(self)
|
||||
self.daemon = True
|
||||
self.oven = oven
|
||||
self.ovenWatcher = ovenWatcher
|
||||
ovenWatcher.add_observer(self)
|
||||
# TODO - move to config
|
||||
self.sleep_time = 0.1
|
||||
self.start()
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
#oven_state = self.oven.get_state()
|
||||
#update_display(oven_state)
|
||||
time.sleep(self.sleep_time)
|
||||
|
||||
def update_display(self, oven_state):
|
||||
log.info(oven_state)
|
||||
|
||||
def send(self,oven_state):
|
||||
self.update_display(oven_state)
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user