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/css/ui.css b/octoprint/static/css/ui.css index 5188b91..f1f9c79 100644 --- a/octoprint/static/css/ui.css +++ b/octoprint/static/css/ui.css @@ -144,4 +144,39 @@ table th.timelapse_files_action, table td.timelapse_files_action { .overflow_visible { overflow: visible !important; +} + +#controls { + overflow: hidden; +} + +#controls .jog-panel { + float: left; + margin-right: 20px; +} + +#controls .jog-panel > h4 { + border-bottom: 1px solid #ddd; +} + +#controls .jog-panel > div { + text-align: center; +} + +#controls .box { + width: 40px; + height: 40px; + margin-right: 20px; + margin-bottom: 20px; +} + +#controls .control-box { + display: block; + height: 40px; + margin-right: 20px; + margin-bottom: 20px; +} + +.text-right { + text-align: right; } \ No newline at end of file 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 8bedf3e..ff08e4c 100644 --- a/octoprint/templates/index.html +++ b/octoprint/templates/index.html @@ -169,26 +169,58 @@
-
-
 
-
-
 
-
+ +
+

X/Y

+
+ +
+
+ + + +
+
+ +
-
-
-
-
-
+ +
+

Z

+
+ +
+
+ +
+
+ +
-
-
 
-
-
 
-
+ +
+

E

+
+
+ + mm +
+ + +
+
+ +
+

General

+
+ + + +
-
+ +