From 12d674882a972b7cb6fbc211db09228917884f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 15 May 2020 19:10:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Only=20unset=20feed/flow=20rate?= =?UTF-8?q?=20after=20request=20completion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/js/app/viewmodels/control.js | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index c90c98072..2e2a68bbf 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -282,13 +282,19 @@ $(function() { OctoPrint.printer.home(axis); }; + self.feedRateBusy = ko.observable(false); + self.feedRateResetter = ko.observable(); self.sendFeedRateCommand = function () { var rate = _.parseInt(self.feedRate()); - OctoPrint.printer.setFeedrate(rate); - self.feedRate(undefined); + self.feedRateBusy(true); + OctoPrint.printer.setFeedrate(rate) + .done(function() { + self.feedRate(undefined); + }) + .always(function() { + self.feedRateBusy(false); + }); }; - - self.feedRateResetter = ko.observable(); self.resetFeedRateDisplay = function() { self.cancelFeedRateDisplayReset(); self.feedRateResetter(setTimeout(function() { @@ -312,13 +318,19 @@ $(function() { self._sendECommand(-1); }; + self.flowRateBusy = ko.observable(false); + self.flowRateResetter = ko.observable(); self.sendFlowRateCommand = function () { var rate = _.parseInt(self.flowRate()); - OctoPrint.printer.setFlowrate(rate); - self.flowRate(undefined); + self.flowRateBusy(true); + OctoPrint.printer.setFlowrate(rate) + .done(function() { + self.flowRate(undefined); + }) + .always(function() { + self.flowRateBusy(false); + }); }; - - self.flowRateResetter = ko.observable(); self.resetFlowRateDisplay = function() { self.cancelFlowRateDisplayReset(); self.flowRateResetter(setTimeout(function() {