From ce7546b781f8418a68f642fb5ebf883a75b8e93b Mon Sep 17 00:00:00 2001 From: mfm Date: Wed, 24 Jan 2018 19:05:28 +0100 Subject: [PATCH] leveling: Added speed settings parameter --- octoprint_klipper/__init__.py | 2 ++ .../static/js/klipper_leveling.js | 23 +++++++++++++------ .../templates/klipper_settings.jinja2 | 14 ++++++++++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/octoprint_klipper/__init__.py b/octoprint_klipper/__init__.py index 4adae1d..1d75ba9 100644 --- a/octoprint_klipper/__init__.py +++ b/octoprint_klipper/__init__.py @@ -24,6 +24,8 @@ class KlipperPlugin( macros=[{'name':"Echo", 'macro':"ECHO"}], probeHeight=0, probeLift=5, + probeSpeedXy=800, + probeSpeedZ=500, probePoints=[{'x':0, 'y':0}]) def get_template_configs(self): diff --git a/octoprint_klipper/static/js/klipper_leveling.js b/octoprint_klipper/static/js/klipper_leveling.js index 6106941..0e4b575 100644 --- a/octoprint_klipper/static/js/klipper_leveling.js +++ b/octoprint_klipper/static/js/klipper_leveling.js @@ -14,23 +14,23 @@ $(function() { self.startLeveling = function() { self.activePoint(0); OctoPrint.control.sendGcode("G28") - self.moveToPoint(self.activePoint); + self.moveToPoint(self.activePoint()); } self.stopLeveling = function() { self.activePoint(-1); - OctoPrint.control.sendGcode("G1 Z" + self.settings.settings.plugins.klipper.probeHeight() + self.settings.settings.plugins.klipper.probeLift()); + OctoPrint.control.sendGcode("G1 Z" + (self.settings.settings.plugins.klipper.probeHeight()*1 + self.settings.settings.plugins.klipper.probeLift()*1)); OctoPrint.control.sendGcode("G28") } self.nextPoint = function() { self.activePoint(self.activePoint()+1); - self.moveToPoint(self.activePoint); + self.moveToPoint(self.activePoint()); } self.previousPoint = function() { self.activePoint(self.activePoint()-1); - self.moveToPoint(self.activePoint); + self.moveToPoint(self.activePoint()); } self.pointCount = function() { @@ -40,9 +40,18 @@ $(function() { self.moveToPoint = function(index) { var point = self.settings.settings.plugins.klipper.probePoints()[index]; - OctoPrint.control.sendGcode("G1 Z" + self.settings.settings.plugins.klipper.probeHeight() + self.settings.settings.plugins.klipper.probeLift()); - OctoPrint.control.sendGcode("G1 X" + point.x() + " Y" + point.y()); - OctoPrint.control.sendGcode("G1 Z" + self.settings.settings.plugins.klipper.probeHeight()); + OctoPrint.control.sendGcode( + "G1 Z" + (self.settings.settings.plugins.klipper.probeHeight()*1 + self.settings.settings.plugins.klipper.probeLift()*1) + + " F" + self.settings.settings.plugins.klipper.probeSpeedZ() + ); + OctoPrint.control.sendGcode( + "G1 X" + point.x() + " Y" + point.y() + + " F" + self.settings.settings.plugins.klipper.probeSpeedXy() + ); + OctoPrint.control.sendGcode( + "G1 Z" + self.settings.settings.plugins.klipper.probeHeight() + + " F" + self.settings.settings.plugins.klipper.probeSpeedZ() + ); } } diff --git a/octoprint_klipper/templates/klipper_settings.jinja2 b/octoprint_klipper/templates/klipper_settings.jinja2 index a80a6b2..1155db4 100644 --- a/octoprint_klipper/templates/klipper_settings.jinja2 +++ b/octoprint_klipper/templates/klipper_settings.jinja2 @@ -67,7 +67,19 @@
- + +
+ +
+ +
+
+
+ +
+ +
+
{{ _('Probe Points') }}