New feature: Added feature for printer movement control by keyboard
-added a new field in the control-section, for controlling the movement of the printer by keypresses. To control you printer by keypress, you have to connect to printer first. Then click into the textfield to activate it. Now you can press the arrow keys, to move the printhead in the X- and Y-directions, press the W or S key for Z-direction or the number keys 1, 2, 3 or 4 for choose the distance (0.1mm, 1mm....)
This commit is contained in:
parent
10d76ae7a4
commit
38ea4ff98f
3 changed files with 1603 additions and 5 deletions
File diff suppressed because one or more lines are too long
|
|
@ -259,4 +259,67 @@ function ControlViewModel(loginStateViewModel, settingsViewModel) {
|
|||
self.onStartup = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.keycontrolText = ko.observable("Nothing");
|
||||
|
||||
self.doKeyControl = function(data, event) {
|
||||
switch(event.which) {
|
||||
case 37: // left arrow key
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Left (X-)");
|
||||
self.sendJogCommand('x',-1);
|
||||
return;
|
||||
case 38: // up arrow key
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Up (Y+)");
|
||||
self.sendJogCommand('y',1);
|
||||
return;
|
||||
case 39: // right arrow key
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Right (X+)");
|
||||
self.sendJogCommand('x',1);
|
||||
return;
|
||||
case 40: // down arrow key
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Down (Y-)");
|
||||
self.sendJogCommand('y',-1);
|
||||
return;
|
||||
case 49: // number 1: Distance 0.1
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Distance 0.1");
|
||||
distbtn1.click();
|
||||
return;
|
||||
case 50: // number 2: Distance 1
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Distance 1");
|
||||
distbtn2.click();
|
||||
return;
|
||||
case 51: // number 3: Distance 10
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Distance 10");
|
||||
distbtn3.click();
|
||||
return;
|
||||
case 52: // number 4: Distance 100
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Distance 100");
|
||||
distbtn4.click();
|
||||
return;
|
||||
case 87: // w key: z lift up
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Z Lift up (Z+)");
|
||||
self.sendJogCommand('z',1);
|
||||
return;
|
||||
case 83: // s key: z lift down
|
||||
event.preventDefault();
|
||||
self.keycontrolText("Z Lift down (Z-)");
|
||||
self.sendJogCommand('z',-1);
|
||||
return;
|
||||
default:
|
||||
event.preventDefault();
|
||||
self.keycontrolText("no known shortcut");
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,15 +384,42 @@
|
|||
<button class="btn box" data-bind="enable: isOperational() && !isPrinting() && loginState.isUser(), click: function() { $root.sendJogCommand('z',-1) }"><i class="icon-arrow-down"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Jog distance -->
|
||||
<div class="distance">
|
||||
<div class="btn-group" data-toggle="buttons-radio" id="jog_distance">
|
||||
<button type="button" class="btn distance" data-distance="0.1" data-bind="enable: loginState.isUser()">0.1</button>
|
||||
<button type="button" class="btn distance" data-distance="1" data-bind="enable: loginState.isUser()">1</button>
|
||||
<button type="button" class="btn distance active" data-distance="10" data-bind="enable: loginState.isUser()">10</button>
|
||||
<button type="button" class="btn distance" data-distance="100" data-bind="enable: loginState.isUser()">100</button>
|
||||
<button type="button" id="distbtn1" class="btn distance" data-distance="0.1" data-bind="enable: loginState.isUser()">0.1</button>
|
||||
<button type="button" id="distbtn2" class="btn distance" data-distance="1" data-bind="enable: loginState.isUser()">1</button>
|
||||
<button type="button" id="distbtn3" class="btn distance active" data-distance="10" data-bind="enable: loginState.isUser()">10</button>
|
||||
<button type="button" id="distbtn4" class="btn distance" data-distance="100" data-bind="enable: loginState.isUser()">100</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shortcut Control -->
|
||||
<div class="keycontrol">
|
||||
<h1>{{ _('Key-Control') }}</h1>
|
||||
<div class="keycontroltext">
|
||||
<small>
|
||||
{{ _('Arrow keys') }}:<br>
|
||||
W, S:<br>
|
||||
1-4:
|
||||
</small>
|
||||
</div>
|
||||
<div class="keycontroltext">
|
||||
<small>
|
||||
<strong>X+,X-, Y+,Y-</strong><br>
|
||||
<strong>{{ _('lift up/down (Z+,Z-)') }}</strong><br>
|
||||
<strong>{{ _('Distance') }} (0.1, 1..)</strong>
|
||||
</small>
|
||||
</div>
|
||||
<div class="keycontrolinput">
|
||||
<input type="text" data-bind="value: $root.keycontrolText, valueUpdate: 'keyup', enable: isOperational() && !isPrinting() && loginState.isUser(), event: { keydown: doKeyControl }"></input>
|
||||
</div>
|
||||
<div class="keycontrol">
|
||||
<em>{{ _('Click into Textfield and press key<br>for control') }}</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Extrusion control panel -->
|
||||
<div class="jog-panel" style="display: none;" data-bind="visible: loginState.isUser">
|
||||
|
|
|
|||
Loading…
Reference in a new issue