diff --git a/octoprint/server.py b/octoprint/server.py index 5fde4a9..43a00b0 100644 --- a/octoprint/server.py +++ b/octoprint/server.py @@ -202,6 +202,10 @@ def jog(): if "homeZ" in request.values.keys(): # home z printer.command("G28 Z0") + if "extrude" in request.values.keys(): + # extrude/retract + length = request.values["extrude"] + printer.commands(["G91", "G1 E" + length + " F300", "G90"]) return jsonify(SUCCESS) diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 2c88413..ddd5b2d 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -355,6 +355,7 @@ function ControlsViewModel() { self.isReady = ko.observable(undefined); self.isLoading = ko.observable(undefined); + self.extrusionAmount = ko.observable(undefined); self.controls = ko.observableArray([]); self.fromCurrentData = function(data) { @@ -426,6 +427,26 @@ function ControlsViewModel() { }) } + self.sendExtrudeCommand = function() { + self._sendECommand(1); + } + + self.sendRetractCommand = function() { + self._sendECommand(-1); + } + + self._sendECommand = function(dir) { + var length = self.extrusionAmount(); + if (!length) + length = 5; + $.ajax({ + url: AJAX_BASEURL + "control/jog", + type: "POST", + dataType: "json", + data: "extrude=" + (dir * length) + }) + } + self.sendCustomCommand = function(command) { if (!command) return; diff --git a/octoprint/templates/index.html b/octoprint/templates/index.html index 152b86c..ff08e4c 100644 --- a/octoprint/templates/index.html +++ b/octoprint/templates/index.html @@ -201,35 +201,26 @@

E

-
- +
+ mm
-
- - - -
+ +
- - +
+

General

- +
-
+