Better extruder/nozzle offset editing in the printer profiles

If only one tool is configured, the profile dialog now won't show the offset configuration. If more than one extruder is configured offset configuration for anything but the first tool (which acts as reference for the relative offsets of the others) will be shown.

Closes #677
This commit is contained in:
Gina Häußge 2015-05-05 10:28:21 +02:00
parent 2d14625fd0
commit 2ef3930fc3
4 changed files with 26 additions and 15 deletions

View file

@ -122,6 +122,8 @@
and [#852](https://github.com/foosel/OctoPrint/pull/852)). Printer profiles now contain a new settings ``volume.origin``
which can either be ``lowerleft`` or ``center``. For circular beds only ``center`` is supported.
* Made baudrate detection a bit more solid, still can't perform wonders.
* Only show configuration options for additional extruders if more than one is available, and don't include offset
configuration for first nozzle which acts as reference for the other offsets ([#677](https://github.com/foosel/OctoPrint/issues/677)).
### Bug Fixes

File diff suppressed because one or more lines are too long

View file

@ -130,9 +130,10 @@ $(function() {
numExtruders = 1;
}
if (numExtruders > extruderOffsets.length) {
if (numExtruders - 1 > extruderOffsets.length) {
for (var i = extruderOffsets.length; i < numExtruders; i++) {
extruderOffsets[i] = {
idx: i + 1,
x: ko.observable(0),
y: ko.observable(0)
}
@ -140,7 +141,7 @@ $(function() {
self.editorExtruderOffsets(extruderOffsets);
}
return extruderOffsets.slice(0, numExtruders);
return extruderOffsets.slice(0, numExtruders - 1);
});
self.editorNameInvalid = ko.computed(function() {
@ -319,12 +320,15 @@ $(function() {
self.editorNozzleDiameter(data.extruder.nozzleDiameter);
self.editorExtruders(data.extruder.count);
var offsets = [];
_.each(data.extruder.offsets, function(offset) {
offsets.push({
x: ko.observable(offset[0]),
y: ko.observable(offset[1])
if (data.extruder.count > 1) {
_.each(_.slice(data.extruder.offsets, 1), function(offset, index) {
offsets.push({
idx: index + 1,
x: ko.observable(offset[0]),
y: ko.observable(offset[1])
});
});
});
}
self.editorExtruderOffsets(offsets);
self.editorAxisXSpeed(data.axes.x.speed);
@ -409,10 +413,14 @@ $(function() {
};
if (self.editorExtruders() > 1) {
for (var i = 1; i < self.editorExtruders(); i++) {
for (var i = 0; i < self.editorExtruders() - 1; i++) {
var offset = [0.0, 0.0];
if (i < self.editorExtruderOffsets().length) {
offset = [parseFloat(self.editorExtruderOffsets()[i]["x"]()), parseFloat(self.editorExtruderOffsets()[i]["y"]())];
try {
offset = [parseFloat(self.editorExtruderOffsets()[i]["x"]()), parseFloat(self.editorExtruderOffsets()[i]["y"]())];
} catch (exc) {
log.error("Invalid offset in profile", identifier, "for extruder", i+1, ":", self.editorExtruderOffsets()[i]["x"], ",", self.editorExtruderOffsets()[i]["y"]);
}
}
profile.extruder.offsets.push(offset);
}

View file

@ -167,19 +167,20 @@
<div class="control-group">
<label class="control-label">{{ _('Number of Extruders') }}</label>
<div class="controls">
<input type="number" class="input-mini text-right" min="1" max="5" data-bind="value: printerProfiles.editorExtruders">
<input type="number" class="input-mini text-right" min="1" max="10" data-bind="value: printerProfiles.editorExtruders">
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Extruder Offsets') }}</label>
<div class="control-group" data-bind="visible: printerProfiles.editorExtruders() > 1">
<label class="control-label">{{ _('Nozzle Offsets (relative to first nozzle T0)') }}</label>
<!-- ko foreach: printerProfiles.koEditorExtruderOffsets -->
<div class="controls form-inline">
<label>X:</label>
<label>T<span data-bind="text: idx"></span>:</label>
<label>X</label>
<div class="input-append">
<input type="number" step="0.01" class="input-mini text-right" data-bind="value: x">
<span class="add-on">mm</span>
</div>
<label>Y:</label>
<label>Y</label>
<div class="input-append">
<input type="number" step="0.01" class="input-mini text-right" data-bind="value: y">
<span class="add-on">mm</span>