bugfix: machine limits auto extend

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2020-08-12 22:33:20 +02:00
parent 29d5b81b47
commit f4a514cb67
2 changed files with 31 additions and 11 deletions

View File

@ -10,7 +10,7 @@
<v-card-text class="px-0 pt-0 pb-2 content">
<v-row class="px-6" >
<v-col sm-12>
<toolSlider label="VELOCITY" v-bind:target="max_velocity" :max="500" :extender-steps="100" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" class="mt-5" ></toolSlider>
<toolSlider label="VELOCITY" v-bind:target="max_velocity" :max="200" :extender-steps="100" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" class="mt-5" ></toolSlider>
<toolSlider label="ACCEL" v-bind:target="max_accel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" class="mt-5" ></toolSlider>
<toolSlider label="DECEL" v-bind:target="max_accel_to_decel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" class="mt-5" ></toolSlider>
<toolSlider label="SCV" v-bind:target="square_corner_velocity" :max="10" :extender-steps="5" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" class="mt-5" ></toolSlider>

View File

@ -5,7 +5,7 @@
<template>
<v-row>
<v-col class="col-auto"><v-icon @click="decrement">mdi-minus</v-icon></v-col>
<v-col class="col"><v-slider v-model="value" thumb-label="always" :label="label" :min="min" :max="max" @change="sendCmd" hide-details></v-slider></v-col>
<v-col class="col"><v-slider v-model="value" thumb-label="always" :label="label" :min="min" :max="variableMax" @change="sendCmd" hide-details></v-slider></v-col>
<v-col class="col-auto"><v-icon @click="increment">mdi-plus</v-icon></v-col>
</v-row>
</template>
@ -16,7 +16,7 @@
data: function() {
return {
value: this.target * this.multi,
variableMax: 0,
variableMax: this.max,
}
},
props: {
@ -79,11 +79,31 @@
this.value++;
this.sendCmd();
},
checkExpand() {
window.console.log("checkExpand: "+this.attributeName);
window.console.log(this.value);
window.console.log(this.variableMax);
window.console.log(this.extenderSteps);
if (this.value > 0) {
if (this.value > this.variableMax) {
let tmpMulti = Math.ceil((this.value - this.variableMax) / this.extenderSteps);
this.variableMax += tmpMulti * this.extenderSteps;
} else if (this.value > (this.variableMax - this.extenderSteps)) {
this.variableMax += this.extenderSteps;
}
}
}
},
watch: {
target: function() {
this.value = this.target * this.multi;
},
value: function() {
setTimeout(() => {
this.checkExpand();
}, 1000);
}
/*value: function() {
if (this.value > 0) {
if (this.value > (this.variableMax - this.extenderSteps) && this.value < (this.variableMax + this.extenderSteps)) this.variableMax += this.extenderSteps;
@ -94,13 +114,13 @@
}
}*/
},
/*created: function() {
/!*window.console.log("Test");
window.console.log(this.target+' * '+this.multi);
this.value = this.target * this.multi;*!/
window.console.log(this.target+' * '+this.multi);
this.variableMax = (this.value / this.extenderSteps + 1).toFixed(0) * this.extenderSteps;
if (this.variableMax < this.max) this.variableMax = this.max;
}*/
created: function() {
if (this.value > this.variableMax) {
let tmpMulti = Math.ceil((this.value - this.variableMax) / this.extenderSteps);
this.variableMax += tmpMulti * this.extenderSteps;
if (this.variableMax === this.value) this.variableMax += this.extenderSteps;
}
}
}
</script>