From e3db2731ab6a9bcb11804c73edcfb85e50812fc4 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 6 Jan 2022 13:11:35 +0100 Subject: [PATCH] fix: only update / send temp commands if they are changed Signed-off-by: Stefan Dej --- src/components/inputs/ToolInput.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/inputs/ToolInput.vue b/src/components/inputs/ToolInput.vue index 2702eaba..68e86d6a 100644 --- a/src/components/inputs/ToolInput.vue +++ b/src/components/inputs/ToolInput.vue @@ -27,7 +27,7 @@ item-text="value" type="number" @keyup.enter="setTemps" - @keyup.tab="setTemps" + @keydown.tab="setTemps" @change="changeValue" @blur="onBlur" hide-spin-buttons @@ -59,7 +59,7 @@ export default class ToolInput extends Mixins(BaseMixin) { } onBlur(event: any) { - if ('target' in event && event.target && 'value' in event.target && this.value !== event.target.value) { + if ('target' in event && event.target && 'value' in event.target) { this.value = event.target.value ?? this.value this.setTemps() } @@ -67,7 +67,7 @@ export default class ToolInput extends Mixins(BaseMixin) { setTemps(): void { if (typeof this.value === 'object') this.value = this.value.value ?? 0 - if (this.value === '') this.value = 0 + if (this.value === null) this.value = 0 if (this.value > this.max_temp) { this.value = { value: this.target, text: this.target } @@ -75,7 +75,7 @@ export default class ToolInput extends Mixins(BaseMixin) { } else if (this.value < this.min_temp && this.value != 0) { this.value = { value: this.target, text: this.target } this.$toast.error(this.$t('Panels.ToolsPanel.TempTooLow', { name: this.name, min: this.min_temp })+'') - } else { + } else if (this.target !== parseFloat(this.value)) { const gcode = this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) this.$socket.emit('printer.gcode.script', { script: gcode })