From 4b5eff5ec64abbc4283cfcd119a9f2feb6cda7ac Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Thu, 26 Oct 2017 12:42:55 -0400 Subject: [PATCH 1/3] Don't set target temp for tools that do not exist. --- src/octoprint/util/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 9799127a3..11551adb7 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2604,7 +2604,7 @@ class MachineCom(object): if not match and support_r: match = regexes_parameters["floatR"].search(cmd) - if match: + if match and self.last_temperature.tools.get(toolNum) is not None: try: target = float(match.group("value")) self.last_temperature.set_tool(toolNum, target=target) From b2552795dc0233d21bd5075d611ec85af14fc144 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Thu, 26 Oct 2017 13:12:38 -0400 Subject: [PATCH 2/3] Set tools actual/target to 0 if they dont exist. --- src/octoprint/static/js/app/viewmodels/temperature.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index 55c8cc50f..719825dbd 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -210,6 +210,9 @@ $(function() { if (lastData.hasOwnProperty("tool" + i)) { tools[i]["actual"](lastData["tool" + i].actual); tools[i]["target"](lastData["tool" + i].target); + } else { + tools[i]["actual"](0); + tools[i]["target"](0); } } From bf7d4173cd96c1443b8f4446f33ad0ec0a7f7b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 27 Oct 2017 14:22:03 +0200 Subject: [PATCH 3/3] Fix auto-adjust of temperature y axis Thanks @Salandora for the heads-up --- .../static/js/app/viewmodels/temperature.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index 719825dbd..493948355 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -296,19 +296,25 @@ $(function() { var plotInfo = self._getPlotInfo(); if (plotInfo === undefined) return; - // update the data - self.plot.setData(plotInfo.data); - self.plot.getAxes().yaxis.max = Math.max(Math.max.apply(null, plotInfo.max) * 1.1, 310); - self.updateLegend(self._replaceLegendLabel); - self.plot.draw(); + var newMax = Math.max(Math.max.apply(null, plotInfo.max) * 1.1, 310); + if (newMax !== self.plot.getAxes().yaxis.max) { + // re-init (because flot apparently has NO way to change the max value of an axes :/) + self._initializePlot(true, plotInfo); + } else { + // update the data + self.plot.setData(plotInfo.data); + self.plot.setupGrid(); + self.updateLegend(self._replaceLegendLabel); + self.plot.draw(); + } }; - self._initializePlot = function(force) { + self._initializePlot = function(force, plotInfo) { var graph = $("#temperature-graph"); if (!graph.length) return; // no graph if (self.plot && !force) return; // already initialized - var plotInfo = self._getPlotInfo(); + plotInfo = plotInfo || self._getPlotInfo(); if (plotInfo === undefined) return; // we don't have a plot yet, we need to set stuff up