From 108db045cec69bdb71c724ed4b3811f8c034c7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 18 Oct 2018 18:06:01 +0200 Subject: [PATCH 1/4] Small changes to the contribution guidelines * allow PRs against `maintenance` branch for improvements and small new features * suggest getting in touch on the forum for larger changes --- CONTRIBUTING.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 861215f4d..e4321207d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ to **address problems in a timely manner** but also keep it possible for them to **fix bugs, add new and improve on existing functionality** instead of doing nothing but ticket management. -![Ticket flow chart](https://i.imgur.com/SmU7iCJ.png) +![Ticket flow chart](https://i.imgur.com/cw19qHX.png) - **[Read the FAQ](https://faq.octoprint.org)** - If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report) @@ -301,7 +301,8 @@ the documentation. the discussion going on how best to solve *this* in OctoPrint's plugin system - maybe that's the actual PR you have been waiting for to contribute :) 2. If you plan to make **any large or otherwise disruptive changes to the - code or appearance, please open a "Brainstorming" ticket first** so + code or appearance, please get in touch on the + [forums](https://discourse.octoprint.org/c/development)** first so that we can determine if it's a good time for your specific pull request. It might be that we're currently in the process of making heavy changes to the code locations you'd target as well, or your @@ -311,7 +312,8 @@ the documentation. 3. Create your pull request **from a custom branch** on your end (e.g. `dev/myNewFeature`)[1]. 4. Create your pull request **only against the `maintenance` or `devel` branch**: - * if it's a bug fix for a bug in the current stable version: `maintenance` branch + * if it's a bug fix for a bug in the current stable version, an improvement of existing functionality or a + *small* new feature (e.g. a new hook, a new config flag, ...): `maintenance` branch * otherwise: `devel` branch 5. Create **one pull request per feature/bug fix**. 6. Make sure there are **only relevant changes** included in your PR. No @@ -472,7 +474,9 @@ the local version identifier to allow for an exact determination of the active c * 2017-11-22: Added note on how to run the unit tests * 2018-03-15: Link to new community forum and some clarifications re bug reporting - * 2018-03-29: "Where to find version numbers" is now located on the FAQ + * 2018-03-29: "Where to find version numbers" is now located on the FAQ + * 2018-10-18: Allow PRs against `maintenance` branch for improvements and small + new features, suggest getting in touch on the forum for larger changes ## Footnotes * [1] - If you are wondering why, the problem is that anything that you add From 2f89082df21d37aab22553643ddab3c8000b8cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 19 Oct 2018 13:14:31 +0200 Subject: [PATCH 2/4] Missed something in yesterday's changes to contrib guide --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4321207d..97299046d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,11 +39,11 @@ nothing but ticket management. [community forum at discourse.octoprint.org](https://discourse.octoprint.org) for such support issues. - If you are a **developer** that wants to brainstorm a pull request or possible - changes to the plugin system, add [Brainstorming] to your issue's title (e.g. - `[Brainstorming] New plugin hook for doing some cool stuff`). + changes to the plugin system, please get in touch on the + [community forum at discourse.octoprint.org](https://discourse.octoprint.org/c/development). - If you need **support**, have a **question** or some **other reason** that doesn't fit any of the above categories, the issue tracker is not the right place. - Consult the [community forum at discourse.octoprint.org](https://discourse.octoprint.org) instead. + Consult the [community forum at discourse.octoprint.org](https://discourse.octoprint.org/c/support) instead. No matter what kind of ticket you create, never mix two or more "ticket reasons" into one ticket: One ticket per bug, request, brainstorming thread please. @@ -53,7 +53,7 @@ into one ticket: One ticket per bug, request, brainstorming thread please. > A bot is in place that monitors new tickets, automatically > categorizes them and checks new bug reports for usage of the provided template. > That bot will only bother you if you open a ticket that appears to be a bug (no -> `[Request]` or `[Brainstorming]` in the title) without the complete template, and it +> `[Request]` in the title) without the complete template, and it > will do that only to ensure that all information needed to solve the issue is > available for the maintainers to directly start tackling that problem. From 00aa4876e9848ee8d4c772b7035df1048205d08b Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Tue, 30 Oct 2018 19:01:20 -0700 Subject: [PATCH 3/4] Added support to specify extrude/retract speed. Only at REST API. No UI changes were made --- AUTHORS.md | 1 + docs/api/printer.rst | 2 ++ src/octoprint/printer/__init__.py | 4 +++- src/octoprint/printer/standard.py | 11 +++++++++-- src/octoprint/server/api/printer.py | 3 ++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 483e6b722..09e51f9cf 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -91,6 +91,7 @@ date of first contribution): * [Ganey](https://github.com/ganey) * [Sven Lohrmann](https://github.com/malnvenshorn) * [Andy Castille](https://github.com/klikini) + * [Gaston Dombiak](https://github.com/gdombiak) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/docs/api/printer.rst b/docs/api/printer.rst index 98f4ccbff..6ba04077e 100644 --- a/docs/api/printer.rst +++ b/docs/api/printer.rst @@ -362,6 +362,8 @@ Issue a tool command Extrudes the given amount of filament from the currently selected tool. Additional parameters: * ``amount``: The amount of filament to extrude in mm. May be negative to retract. + * ``speed``: Optional. Speed at which to extrude. If not provided, maximum speed for E axis from printer + profile will be used. Otherwise interpreted as an integer signifying the speed in mm/s, to append to the command. flowrate Changes the flow rate factor to apply to extrusion of the tool. diff --git a/src/octoprint/printer/__init__.py b/src/octoprint/printer/__init__.py index 67150b1b1..4ae7222e9 100644 --- a/src/octoprint/printer/__init__.py +++ b/src/octoprint/printer/__init__.py @@ -231,12 +231,14 @@ class PrinterInterface(object): """ raise NotImplementedError() - def extrude(self, amount, tags=None, *args, **kwargs): + def extrude(self, amount, speed=None, tags=None, *args, **kwargs): """ Extrude ``amount`` millimeters of material from the tool. Arguments: amount (int, float): The amount of material to extrude in mm + speed (int, None): Speed at which to extrude (F parameter). If set to ``None`` (or left out) + the maximum speed of E axis from the printer profile will be used. tags (set of str): An optional set of tags to attach to the command(s) throughout their lifecycle """ raise NotImplementedError() diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 989b6095e..044e32cbc 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -361,12 +361,19 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), validated_axes)), "G90"], tags=kwargs.get("tags", set) | {"trigger:printer.home"}) - def extrude(self, amount, *args, **kwargs): + def extrude(self, amount, speed=None, *args, **kwargs): if not isinstance(amount, (int, long, float)): raise ValueError("amount must be a valid number: {amount}".format(amount=amount)) printer_profile = self._printerProfileManager.get_current_or_default() - extrusion_speed = printer_profile["axes"]["e"]["speed"] + + # Use specified speed (if any) + extrusion_speed = speed + + if speed is None: + # No speed was specified so default to value configured in printer profile + extrusion_speed = printer_profile["axes"]["e"]["speed"] + self.commands(["G91", "G1 E%s F%d" % (amount, extrusion_speed), "G90"], tags=kwargs.get("tags", set()) | {"trigger:printer.extrude"}) diff --git a/src/octoprint/server/api/printer.py b/src/octoprint/server/api/printer.py index 0452e9e03..561efcfde 100644 --- a/src/octoprint/server/api/printer.py +++ b/src/octoprint/server/api/printer.py @@ -129,9 +129,10 @@ def printerToolCommand(): return make_response("Printer is currently printing", 409) amount = data["amount"] + speed = data.get("speed", None) if not isinstance(amount, (int, long, float)): return make_response("Not a number for extrusion amount: %r" % amount, 400) - printer.extrude(amount, tags=tags) + printer.extrude(amount, speed=speed, tags=tags) elif command == "flowrate": factor = data["factor"] From 5ee242be4ae33986dc2dcbc5a1307b19d8cae8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 31 Oct 2018 11:54:17 +0100 Subject: [PATCH 4/4] Fix doc bug: mm/s => mm/min --- docs/api/printer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/printer.rst b/docs/api/printer.rst index 6ba04077e..c110a6de1 100644 --- a/docs/api/printer.rst +++ b/docs/api/printer.rst @@ -363,7 +363,7 @@ Issue a tool command * ``amount``: The amount of filament to extrude in mm. May be negative to retract. * ``speed``: Optional. Speed at which to extrude. If not provided, maximum speed for E axis from printer - profile will be used. Otherwise interpreted as an integer signifying the speed in mm/s, to append to the command. + profile will be used. Otherwise interpreted as an integer signifying the speed in mm/min, to append to the command. flowrate Changes the flow rate factor to apply to extrusion of the tool.