From 09b07274ab631fe1dd051bb7a1e418bd6c1f8e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 7 Apr 2020 15:33:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Remove=20feed/flow=20rate=20upper?= =?UTF-8?q?=20limits=20altogether?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gets rid of sliders as well (since those don't work without an upper limit) and adds a note to both that they are "write-only" as we don't have a way to query the current values from the firmware (yay...). Modifies #3503 Also fixes a bug in #3503, which only adjusted the client side boundaries but forgot about the server side. --- docs/jsclientlib/printer.rst | 4 ++-- src/octoprint/printer/standard.py | 12 +++++++----- src/octoprint/templates/tabs/control.jinja2 | 20 +++++++++++++++----- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/jsclientlib/printer.rst b/docs/jsclientlib/printer.rst index 88b9f61fa..e0c014bab 100644 --- a/docs/jsclientlib/printer.rst +++ b/docs/jsclientlib/printer.rst @@ -144,7 +144,7 @@ Sets the current flowrate multiplier. - ``factor`` is expected to be a integer value between 75 and 125 representing the new flowrate percentage. + ``factor`` is expected to be a integer value >0 representing the new flowrate percentage. See the ``flowrate`` command in :ref:`Issue a tool command ` for more details. @@ -325,7 +325,7 @@ Sets the feedrate multiplier to use. - ``factor`` is expected to be a integer value between 0 and 300 representing the new feedrate percentage. + ``factor`` is expected to be a integer value >0 representing the new feedrate percentage. See the ``feedrate`` command in :ref:`Issue a print head command ` for more details. diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index e870c36e6..3ca5282d0 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -456,25 +456,27 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self._comm.setTemperatureOffset(offsets) self._setOffsets(self._comm.getOffsets()) - def _convert_rate_value(self, factor, min=0, max=200): + def _convert_rate_value(self, factor, min_val=None, max_val=None): if not isinstance(factor, (int, float, long)): raise ValueError("factor is not a number") if isinstance(factor, float): factor = int(factor * 100.0) - if factor < min or factor > max: - raise ValueError("factor must be a value between {} and {}".format(min, max)) + if min_val and factor < min_val: + raise ValueError("factor must be a value >={}".format(min_val)) + elif max_val and factor > max_val: + raise ValueError("factor must be a value <={}".format(max_val)) return factor def feed_rate(self, factor, *args, **kwargs): - factor = self._convert_rate_value(factor, min=50, max=200) + factor = self._convert_rate_value(factor, min_val=1) self.commands("M220 S%d" % factor, tags=kwargs.get("tags", set()) | {"trigger:printer.feed_rate"}) def flow_rate(self, factor, *args, **kwargs): - factor = self._convert_rate_value(factor, min=75, max=125) + factor = self._convert_rate_value(factor, min_val=1) self.commands("M221 S%d" % factor, tags=kwargs.get("tags", set()) | {"trigger:printer.flow_rate"}) diff --git a/src/octoprint/templates/tabs/control.jinja2 b/src/octoprint/templates/tabs/control.jinja2 index a862991c2..ea58b269b 100644 --- a/src/octoprint/templates/tabs/control.jinja2 +++ b/src/octoprint/templates/tabs/control.jinja2 @@ -80,8 +80,12 @@
- - + +
+ + % + +
@@ -98,15 +102,21 @@
- + mm
- - +
+ +
+ + % + +
+