leveling: Enabled direct move to point
This commit is contained in:
parent
2e95fa1663
commit
b5411c26fc
|
@ -12,40 +12,45 @@ $(function() {
|
|||
}
|
||||
|
||||
self.startLeveling = function() {
|
||||
self.activePoint(0);
|
||||
OctoPrint.control.sendGcode("G28")
|
||||
self.moveToPoint(self.activePoint());
|
||||
self.moveToPoint(0);
|
||||
}
|
||||
|
||||
self.stopLeveling = function() {
|
||||
self.activePoint(-1);
|
||||
OctoPrint.control.sendGcode("G1 Z" + (self.settings.settings.plugins.klipper.probeHeight()*1 + self.settings.settings.plugins.klipper.probeLift()*1));
|
||||
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()+1);
|
||||
}
|
||||
|
||||
self.previousPoint = function() {
|
||||
self.activePoint(self.activePoint()-1);
|
||||
self.moveToPoint(self.activePoint());
|
||||
self.moveToPoint(self.activePoint()-1);
|
||||
}
|
||||
|
||||
self.jumpToPoint = function(item) {
|
||||
self.moveToPoint(
|
||||
self.settings.settings.plugins.klipper.probePoints().indexOf(item)
|
||||
);
|
||||
}
|
||||
|
||||
self.pointCount = function() {
|
||||
return self.settings.settings.plugins.klipper.probePoints().length;
|
||||
}
|
||||
|
||||
self.moveToPoint = function(index) {
|
||||
var point = self.settings.settings.plugins.klipper.probePoints()[index];
|
||||
|
||||
OctoPrint.control.sendGcode(
|
||||
"G1 Z" + (self.settings.settings.plugins.klipper.probeHeight()*1 + self.settings.settings.plugins.klipper.probeLift()*1) +
|
||||
self.moveToPosition = function(x, y) {
|
||||
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() +
|
||||
"G1 X" + x + " Y" + y +
|
||||
" F" + self.settings.settings.plugins.klipper.probeSpeedXy()
|
||||
);
|
||||
OctoPrint.control.sendGcode(
|
||||
|
@ -53,6 +58,13 @@ $(function() {
|
|||
" F" + self.settings.settings.plugins.klipper.probeSpeedZ()
|
||||
);
|
||||
}
|
||||
|
||||
self.moveToPoint = function(index) {
|
||||
var point = self.settings.settings.plugins.klipper.probePoints()[index];
|
||||
|
||||
self.moveToPosition(point.x(), point.y());
|
||||
self.activePoint(index);
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
<div class="modal-body">
|
||||
<div class="row-fluid">
|
||||
<div class="span3">
|
||||
<button class="btn btn-block" data-bind="click: startLeveling">Start</button>
|
||||
<button class="btn btn-block" data-bind="click: previousPoint, enable: (activePoint() > 0)">Previous</button>
|
||||
<button class="btn btn-block" data-bind="click: nextPoint, enable: (activePoint() < pointCount()-1)">Next</button>
|
||||
<button class="btn btn-block" data-bind="click: stopLeveling" data-dismiss="modal">Close</button>
|
||||
<button class="btn btn-block" data-bind="click: startLeveling"><i class="icon-play"></i> Start</button>
|
||||
<button class="btn btn-block" data-bind="click: previousPoint, enable: (activePoint() > 0)"><i class="icon-step-backward"></i> Previous</button>
|
||||
<button class="btn btn-block" data-bind="click: nextPoint, enable: (activePoint() < pointCount()-1)"><i class="icon-step-forward"></i> Next</button>
|
||||
<button class="btn btn-block" data-bind="click: stopLeveling" data-dismiss="modal"><i class="icon-stop"></i> Stop</button>
|
||||
</div>
|
||||
<div class="span8">
|
||||
<div data-bind="foreach: settings.settings.plugins.klipper.probePoints" >
|
||||
<div class="row-fluid">
|
||||
<div class="span1"><i class="fa fa-arrow-right" data-bind="visible: ($index()==$parent.activePoint())"></i></div>
|
||||
<div class="span9">[<span data-bind="text: x"></span>,<span data-bind="text: y"></span>]</div>
|
||||
<button class="btn btn-mini btn-info" data-bind="click: $parent.jumpToPoint"><span data-bind="text: $index"></span>: (<span data-bind="text: x"></span>, <span data-bind="text: y"></span>)</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue