kopia lustrzana https://github.com/jbruce12000/kiln-controller
backlog ui
rodzic
b85fa912f3
commit
f2e27384e2
|
@ -11,6 +11,7 @@ class OvenWatcher(threading.Thread):
|
|||
self.observers = []
|
||||
threading.Thread.__init__(self)
|
||||
self.daemon = True
|
||||
self.log_skip_counter = 0
|
||||
|
||||
self.oven = oven
|
||||
self.start()
|
||||
|
@ -20,10 +21,12 @@ class OvenWatcher(threading.Thread):
|
|||
oven_state = self.oven.get_state()
|
||||
|
||||
if oven_state.get("state") == Oven.STATE_RUNNING:
|
||||
if self.log_skip_counter==0:
|
||||
self.last_log.append(oven_state)
|
||||
else:
|
||||
self.recording = False
|
||||
self.notify_all(oven_state)
|
||||
self.log_skip_counter = (self.log_skip_counter +1)%20
|
||||
time.sleep(0.5)
|
||||
|
||||
def record(self, profile):
|
||||
|
@ -33,9 +36,18 @@ class OvenWatcher(threading.Thread):
|
|||
self.recording = True
|
||||
|
||||
def add_observer(self,observer):
|
||||
if self.last_profile:
|
||||
p = {
|
||||
"name": self.last_profile.name,
|
||||
"data": self.last_profile.data,
|
||||
"type" : "profile"
|
||||
}
|
||||
else:
|
||||
p = None
|
||||
|
||||
backlog = {
|
||||
'type': "backlog",
|
||||
'profile': self.last_profile,
|
||||
'profile': p,
|
||||
'log': self.last_log,
|
||||
#'started': self.started
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ def handle_control():
|
|||
profile_json = json.dumps(profile_obj)
|
||||
profile = Profile(profile_json)
|
||||
oven.run_profile(profile)
|
||||
ovenWatcher.record(profile_json)
|
||||
ovenWatcher.record(profile)
|
||||
elif msgdict.get("cmd") == "STOP":
|
||||
log.info("Stop command received")
|
||||
oven.abort_run()
|
||||
|
|
|
@ -181,8 +181,7 @@ function getOptions()
|
|||
font:
|
||||
{
|
||||
size: 12,
|
||||
lineHeight: 14,
|
||||
weight: "normal",
|
||||
lineHeight: 14, weight: "normal",
|
||||
family: "LCDN",
|
||||
variant: "small-caps",
|
||||
color: "rgba(216, 211, 197, 0.85)"
|
||||
|
@ -276,6 +275,18 @@ $(document).ready(function()
|
|||
{
|
||||
x = JSON.parse(e.data);
|
||||
|
||||
if (x.type == "backlog")
|
||||
{
|
||||
if (x.profile)
|
||||
{
|
||||
selected_profile_name = x.profile.name;
|
||||
}
|
||||
|
||||
$.each(x.log, function(i,v) {
|
||||
graph.live.data.push([v.runtime, v.temperature]);
|
||||
graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ] , getOptions());
|
||||
});
|
||||
}
|
||||
if(state!="EDIT")
|
||||
{
|
||||
state = x.state;
|
||||
|
|
Ładowanie…
Reference in New Issue