Feature/motion report (#317)
* test new flow and velocity Signed-off-by: Stefan Dej <meteyou@gmail.com> * test build for live speed & flow Signed-off-by: Stefan Dej <meteyou@gmail.com> * bugfix: fix ToolSlider.vue for printsettings and machine limits Signed-off-by: Stefan Dej <meteyou@gmail.com> * remove debug output Signed-off-by: Stefan Dej <meteyou@gmail.com> * rework MachineLimits Signed-off-by: Stefan Dej <meteyou@gmail.com> * feature: live extruder, toolhead speed and position data in StatusPanel.vue Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
79c490b1a6
commit
aefd4caf5e
9 files changed
+242
-163
No files matched your search
@@ -0,0 +1,60 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<form v-on:submit.prevent="sendCmd">
|
||||
<v-text-field
|
||||
:label="label"
|
||||
:suffix="unit"
|
||||
v-model="value"
|
||||
type="number"
|
||||
outlined
|
||||
dense
|
||||
:append-icon="this.value !== this.defaultValue ? 'mdi-refresh' : ''"
|
||||
:error="this.value > this.defaultValue"
|
||||
@click:append="resetLimit"
|
||||
hide-details
|
||||
></v-text-field>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from "vue-class-component";
|
||||
import {Mixins, Prop, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
|
||||
@Component
|
||||
export default class MachineLimitsInput extends Mixins(BaseMixin) {
|
||||
private value: any = 0
|
||||
|
||||
@Prop({ type: String, required: true }) readonly label!: string
|
||||
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
|
||||
@Prop({ type: Number, required: true, default: 0 }) readonly defaultValue!: number
|
||||
@Prop({ type: Number, required: true, default: 100 }) readonly max!: number
|
||||
@Prop({ type: String, required: true }) readonly attributeName!: string
|
||||
@Prop({ type: String, required: true }) readonly unit!: string
|
||||
|
||||
@Watch('target')
|
||||
targetChanged(newVal: number): void {
|
||||
this.value = newVal
|
||||
}
|
||||
|
||||
created(): void {
|
||||
this.value = this.target
|
||||
}
|
||||
|
||||
resetLimit() {
|
||||
this.value = this.defaultValue
|
||||
|
||||
this.sendCmd()
|
||||
}
|
||||
|
||||
sendCmd() {
|
||||
const gcode = 'SET_VELOCITY_LIMIT ' + this.attributeName + '=' + Math.max(1, this.value).toFixed(0)
|
||||
this.$store.dispatch('server/addEvent', {message: gcode, type: 'command'})
|
||||
this.$socket.emit('printer.gcode.script', {script: gcode})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -15,7 +15,7 @@
|
||||
class="ml-2"
|
||||
x-small
|
||||
icon
|
||||
@click="processedMin = min; processedMax = max; value = defaultValue; sliding = true; sendCmd()"
|
||||
@click="resetSlider"
|
||||
>
|
||||
<v-icon>mdi-restart</v-icon>
|
||||
</v-btn>
|
||||
@@ -49,8 +49,6 @@
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
|
||||
import {Component, Mixins, Prop, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import {Debounce} from "vue-debounce-decorator";
|
||||
@@ -80,8 +78,8 @@ export default class ToolSlider extends Mixins(BaseMixin) {
|
||||
this.startValue = this.target * this.multi
|
||||
this.dynamicStep = Math.floor((this.max - this.min) / 2)
|
||||
|
||||
if (this.value > this.max) {
|
||||
this.processedMax = Math.ceil(this.value / this.defaultValue) * this.defaultValue
|
||||
if (this.value >= this.processedMax) {
|
||||
this.processedMax = (Math.ceil(this.value / this.dynamicStep) + 1) * this.dynamicStep
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +89,8 @@ export default class ToolSlider extends Mixins(BaseMixin) {
|
||||
|
||||
@Debounce(250)
|
||||
changeSlider() {
|
||||
this.sendCmd()
|
||||
|
||||
if (!this.dynamicRange) return
|
||||
if (this.value >= this.processedMax) {
|
||||
this.processedMax = this.value + this.dynamicStep
|
||||
@@ -112,6 +112,16 @@ export default class ToolSlider extends Mixins(BaseMixin) {
|
||||
this.processedMax = newVal > this.value ? newVal : Math.ceil(this.value / this.dynamicStep) * this.dynamicStep
|
||||
}
|
||||
|
||||
resetSlider() {
|
||||
this.value = this.defaultValue
|
||||
this.processedMax = this.max
|
||||
if (this.value >= this.processedMax) {
|
||||
this.processedMax = (Math.ceil(this.value / this.dynamicStep) + 1) * this.dynamicStep
|
||||
}
|
||||
|
||||
this.sendCmd()
|
||||
}
|
||||
|
||||
sendCmd() {
|
||||
const gcode = this.command + ' ' + this.attributeName + (Math.max(1, this.value) * this.attributeScale).toFixed(0)
|
||||
this.$store.dispatch('server/addEvent', {message: gcode, type: 'command'})
|
||||
|
||||
Reference in new issue
Block a user