[feature] Add coordinate offset dialog.
This commit is contained in:
parent
4f16e40d29
commit
8d27f79b65
|
@ -8,6 +8,7 @@ This plugin assists in managing and monitoring the [Klipper](https://github.com/
|
|||
- User defineable macro buttons.
|
||||
- Assisted bed leveling wizard with user definable probe points.
|
||||
- PID Tuning Dialog.
|
||||
- Dialog to set a coordinate offset for future GCODE move commands.
|
||||
- Message log displaying messages from Klipper prepended with "//" and "!!".
|
||||
|
||||
### ToDo
|
||||
|
@ -37,5 +38,8 @@ Click on the wrench icon in the titlebar to open OctoPrints settings dialog. Sel
|
|||
#### PID Tuning
|
||||
![PID Tuning](docs/assets/img/pid-tuning.png)
|
||||
|
||||
#### Coordinate Offset
|
||||
![Coordinate Offset](docs/assets/img/offset.png)
|
||||
|
||||
#### Settings
|
||||
![Settings](docs/assets/img/settings.png)
|
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
|
@ -49,6 +49,7 @@ class KlipperPlugin(
|
|||
dict(type="settings", custom_bindings=True),
|
||||
dict(type="generic", name="Assisted Bed Leveling", template="klipper_leveling_dialog.jinja2", custom_bindings=True),
|
||||
dict(type="generic", name="PID Tuning", template="klipper_pid_tuning_dialog.jinja2", custom_bindings=True),
|
||||
dict(type="generic", name="Coordinate Offset", template="klipper_offset_dialog.jinja2", custom_bindings=True),
|
||||
dict(type="tab", name="Klipper", template="klipper_tab_main.jinja2", suffix="_main", custom_bindings=True),
|
||||
dict(type="sidebar",
|
||||
custom_bindings=True,
|
||||
|
@ -62,7 +63,8 @@ class KlipperPlugin(
|
|||
js=["js/klipper.js",
|
||||
"js/klipper_settings.js",
|
||||
"js/klipper_leveling.js",
|
||||
"js/klipper_pid_tuning.js"],
|
||||
"js/klipper_pid_tuning.js",
|
||||
"js/klipper_offset.js"],
|
||||
css=["css/klipper.css"],
|
||||
less=["css/klipper.less"]
|
||||
)
|
||||
|
|
|
@ -27,6 +27,15 @@ $(function() {
|
|||
});;
|
||||
}
|
||||
|
||||
self.showOffsetDialog = function() {
|
||||
var dialog = $("#klipper_offset_dialog");
|
||||
dialog.modal({
|
||||
show: 'true',
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});;
|
||||
}
|
||||
|
||||
self.executeMacro = function(macro) {
|
||||
OctoPrint.control.sendGcode(macro.macro());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
$(function() {
|
||||
function KlipperOffsetDialogViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.offsetX = ko.observable();
|
||||
self.offsetY = ko.observable();
|
||||
self.offsetZ = ko.observable();
|
||||
self.adjust = ko.observable();
|
||||
|
||||
self.onStartup = function() {
|
||||
self.offsetX(0);
|
||||
self.offsetY(0);
|
||||
self.offsetZ(0);
|
||||
self.adjust(false);
|
||||
}
|
||||
|
||||
self.setOffset = function() {
|
||||
if(self.adjust()) {
|
||||
OctoPrint.control.sendGcode("SET_GCODE_OFFSET X_ADJUST=" + self.offsetX() +
|
||||
" Y_ADJUST=" + self.offsetY() +
|
||||
" Z_ADJUST=" + self.offsetZ());
|
||||
} else {
|
||||
OctoPrint.control.sendGcode("SET_GCODE_OFFSET X=" + self.offsetX() +
|
||||
" Y=" + self.offsetY() +
|
||||
" Z=" + self.offsetZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: KlipperOffsetDialogViewModel,
|
||||
dependencies: [],
|
||||
elements: ["#klipper_offset_dialog"]
|
||||
});
|
||||
});
|
|
@ -0,0 +1,42 @@
|
|||
<div id="klipper_offset_dialog" class="modal hide fade small" tabindex="-1" role="dialog" aria-labelledby="klipper_offset_dialog_label" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h3 id="klipper_pid_tuning_dialog_label">{{ _('Coordinate Offset') }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row-fluid" style="margin-bottom: 15px">
|
||||
<label class="control-label">{{ _('Set an offset for all future GCODE move commands in mm.') }}</label>
|
||||
</div>
|
||||
<div class="row-fluid" style="margin-bottom: 15px">
|
||||
<div class="input-append span3">
|
||||
<input type="text" class="input-block-level span6" data-bind="value: offsetX">
|
||||
<span class="add-on">{{ _('X') }}</span>
|
||||
</div>
|
||||
<div class="input-append span3">
|
||||
<input type="text" class="input-block-level span6" data-bind="value: offsetY">
|
||||
<span class="add-on">{{ _('Y') }}</span>
|
||||
</div>
|
||||
<div class="input-append span3">
|
||||
<input type="text" class="input-block-level span6" data-bind="value: offsetZ">
|
||||
<span class="add-on">{{ _('Z') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid" style="margin-bottom: 15px">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: adjust" id="settings-serialAutoconnect">{{ _('Add to existing offset') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button class="btn btn-block" data-bind="click: setOffset" data-dismiss="modal"><i class="icon-cross"></i> {{ _('Set Offset') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="controls">
|
||||
|
||||
</div>
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Heater Index') }}</label>
|
||||
<label class="control-label">{{ _('Heater / Extruder Name (from config file)') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-block-level span2" data-bind="value: heaterIndex">
|
||||
<span class="add-on">{{ _('index') }}</span>
|
||||
<input type="text" class="input-block-level span2" data-bind="value: heaterName">
|
||||
<span class="add-on">{{ _('name') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<label class="control-label"><i class="icon-wrench"></i> {{ _('Tools') }}</label>
|
||||
<button class="btn btn-block" data-bind="click: showLevelingDialog, enable: isActive()">{{ _('Assisted Bed Leveling') }}</button>
|
||||
<button class="btn btn-block" data-bind="click: showPidTuningDialog, enable: isActive()">{{ _('PID Tuning') }}</button>
|
||||
<button class="btn btn-block" data-bind="click: showOffsetDialog, enable: isActive()">{{ _('Coordinate Offset') }}</button>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<hr>
|
||||
|
|
Loading…
Reference in New Issue