fix motor numbers and parameter order

This commit is contained in:
2017-10-23 22:55:26 +02:00
parent 6ec06be6c8
commit 997d4742d1
6 changed files with 30 additions and 20 deletions

View File

@@ -96,11 +96,11 @@
<label>L</label>
<input type="range" class="laser slider" value="0" max="128">
<label>M1</label>
<input type="range" class="motor slider" value="0" max="128" data-motor-nr="0">
<label>M2</label>
<input type="range" class="motor slider" value="0" max="128" data-motor-nr="1">
<label>M3</label>
<label>M2</label>
<input type="range" class="motor slider" value="0" max="128" data-motor-nr="2">
<label>M3</label>
<input type="range" class="motor slider" value="0" max="128" data-motor-nr="3">
</div>
<div id="prototypControls">
<text class="sectionDesc">last uri:</text>

View File

@@ -99,15 +99,13 @@ var $ = function(selector){
let update = function(endpoint, method, props) {
Sui.http.ajax({
method: method,
endpoint: node.api[endpoint] + props.join('/'),
endpoint: node.api[endpoint] + (props ? props.join('/') : ''),
cache: false
}, actuator.onResponse || null);
};
Sui.select(actuator.selector).forEach( (domEl) =>{
let handle = function(event) {
data = [this.value];
actuator.data ? data.push(actuator.data.call(this)) : undefined;
update.call(this, actuator.api, 'GET', data);
update.call(this, actuator.api, 'GET', actuator.data ? actuator.data.call(this) : undefined );
}
$(domEl).on(actuator.event, handle)
});
@@ -167,7 +165,7 @@ var $ = function(selector){
selector: '.motor.slider',
event: 'change',
data: function(){
return this.getAttribute('data-motor-nr');
return [this.getAttribute('data-motor-nr'), this.value];
},
onResponse: debugResponse
}, {
@@ -175,6 +173,9 @@ var $ = function(selector){
method: 'GET',
selector: '.laser.slider',
event: 'change',
data: function(){
return [this.value];
},
onResponse: debugResponse
}].forEach(Sui.link({
api: {