moved display code to oven
This commit is contained in:
parent
6679867fdd
commit
5ae5916400
44
lib/oven.py
44
lib/oven.py
@ -46,6 +46,30 @@ class Output(object):
|
||||
time.sleep(sleepfor)
|
||||
|
||||
|
||||
|
||||
class Display(object):
|
||||
def __init__(self,
|
||||
type,
|
||||
pins):
|
||||
|
||||
if type == "TMC1637":
|
||||
self.disp = TM1637(pins['clock'],
|
||||
pins['data'])
|
||||
|
||||
def temp(self, t):
|
||||
self.disp.temp(t)
|
||||
|
||||
def time(self, h, m):
|
||||
self.disp.time(h, m)
|
||||
|
||||
def off(self):
|
||||
self.disp.off()
|
||||
|
||||
def text(self, text):
|
||||
self.disp.text(text)
|
||||
|
||||
|
||||
|
||||
# FIX - Board class needs to be completely removed
|
||||
class Board(object):
|
||||
def __init__(self):
|
||||
@ -399,6 +423,26 @@ class RealOven(Oven):
|
||||
# start thread
|
||||
self.start()
|
||||
|
||||
|
||||
try:
|
||||
self.time_disp = Display(config.time_disp['type'],
|
||||
config.time_disp['pins'])
|
||||
self.time_disp.show('TIME')
|
||||
except NameError:
|
||||
self.time_disp = False
|
||||
|
||||
try:
|
||||
self.temp_disp = Display(config.temp_disp['type'],
|
||||
config.temp_disp['pins'])
|
||||
self.time_disp.show('TEMP')
|
||||
except NameError:
|
||||
self.temp_disp = False
|
||||
|
||||
# if self.time_disp:
|
||||
# self.time_disp.time(oven_state['runtime'])
|
||||
# if self.temp_disp:
|
||||
# self.temp_disp.temp(oven_state['temperature'])
|
||||
|
||||
def reset(self):
|
||||
super().reset()
|
||||
self.output.safety_on()
|
||||
|
||||
@ -6,28 +6,6 @@ import config
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Display(object):
|
||||
def __init__(self,
|
||||
type,
|
||||
pins):
|
||||
|
||||
if type == "TMC1637":
|
||||
self.disp = TM1637(pins['clock'],
|
||||
pins['data'])
|
||||
|
||||
def temp(self, t):
|
||||
self.disp.temp(t)
|
||||
|
||||
def time(self, h, m):
|
||||
self.disp.time(h, m)
|
||||
|
||||
def off(self):
|
||||
self.disp.off()
|
||||
|
||||
def text(self, text):
|
||||
self.disp.text(text)
|
||||
|
||||
|
||||
class OvenWatcher(threading.Thread):
|
||||
def __init__(self,oven):
|
||||
self.last_profile = None
|
||||
@ -36,20 +14,6 @@ class OvenWatcher(threading.Thread):
|
||||
self.recording = False
|
||||
self.observers = []
|
||||
|
||||
try:
|
||||
self.time_disp = Display(config.time_disp['type'],
|
||||
config.time_disp['pins'])
|
||||
self.time_disp.show('TIME')
|
||||
except NameError:
|
||||
self.time_disp = False
|
||||
|
||||
try:
|
||||
self.temp_disp = Display(config.temp_disp['type'],
|
||||
config.temp_disp['pins'])
|
||||
self.time_disp.show('TEMP')
|
||||
except NameError:
|
||||
self.temp_disp = False
|
||||
|
||||
threading.Thread.__init__(self)
|
||||
self.daemon = True
|
||||
self.oven = oven
|
||||
@ -74,10 +38,6 @@ class OvenWatcher(threading.Thread):
|
||||
else:
|
||||
self.recording = False
|
||||
self.notify_all(oven_state)
|
||||
if self.time_disp:
|
||||
self.time_disp.time(oven_state['runtime'])
|
||||
if self.temp_disp:
|
||||
self.temp_disp.temp(oven_state['temperature'])
|
||||
time.sleep(self.oven.time_step)
|
||||
|
||||
def lastlog_subset(self,maxpts=50):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user