diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index f239cf315..816f1d1ee 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -235,6 +235,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); } } @@ -318,19 +321,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 diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 0ff0c877a..aa3df6f85 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2605,7 +2605,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)