diff --git a/kiln-controller.py b/kiln-controller.py index cf01d943..ed52c16d 100755 --- a/kiln-controller.py +++ b/kiln-controller.py @@ -258,6 +258,14 @@ def handle_status(): log.info("websocket (status) closed") +@app.get('/log') +def handle_log(): + log.info("/log command received") + if hasattr(oven,'pid'): + if hasattr(oven.pid,'pidstats'): + return json.dumps(ovenWatcher.lastlog()) + + def get_profiles(): try: profile_files = os.listdir(profile_path) diff --git a/lib/ovenWatcher.py b/lib/ovenWatcher.py index 681fa545..744740e6 100644 --- a/lib/ovenWatcher.py +++ b/lib/ovenWatcher.py @@ -34,6 +34,9 @@ def run(self): self.notify_all(oven_state) time.sleep(self.oven.time_step) + def lastlog(self): + return self.last_log + def lastlog_subset(self,maxpts=50): '''send about maxpts from lastlog by skipping unwanted data''' totalpts = len(self.last_log) diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index 82cefc5e..ac2ab78f 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -442,7 +442,8 @@ function getOptions() color: 'rgba(216, 211, 197, 0.55)', borderWidth: 1, labelMargin: 10, - mouseActiveRadius: 50 + mouseActiveRadius: 50, + hoverable: true }, legend: @@ -487,6 +488,33 @@ $(document).ready(function() // }); }; + $("
").css({ + position: "absolute", + display: "none", + border: "1px solid #fdd", + padding: "2px", + "background-color": "#fee", + opacity: 0.80 + }).appendTo("body"); + + $("#graph_container").bind("plothover", function (event, pos, item) { + if (!pos.x || !pos.y) { + return; + } + + if (item) { + const x = item.datapoint[0] + const y = item.datapoint[1].toFixed(0); + + $("#tooltip").html(item.series.label + " at " + + new Date(x * 1000).toISOString().substring(11, 16) + " = " + y + "ยบ" + temp_scale_display) + .css({top: item.pageY+5, left: item.pageX+5}) + .fadeIn(200); + } else { + $("#tooltip").stop().hide(); + } + }) + ws_status.onclose = function() { $.bootstrapGrowl(" ERROR 1:
Status Websocket not available", {