From 18294b6ade8df48f4cdaed904487e1bd2b2320e2 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 1 Mar 2022 00:34:58 +0100 Subject: [PATCH] fix: fix gcode from macros with single char attributes (#680) --- src/components/inputs/MacroButton.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/inputs/MacroButton.vue b/src/components/inputs/MacroButton.vue index d91e6efb8..55b768f6b 100644 --- a/src/components/inputs/MacroButton.vue +++ b/src/components/inputs/MacroButton.vue @@ -79,7 +79,8 @@ export default class MacroButton extends Mixins(BaseMixin) { private paramArray: string[] = [] private params: params = {} - @Prop({ required: true }) declare readonly macro: GuiMacrosStateMacrogroupMacro + @Prop({ required: true }) + declare readonly macro: GuiMacrosStateMacrogroupMacro @Prop({ default: 'primary' }) declare readonly color: string get klipperMacro() { @@ -110,15 +111,23 @@ export default class MacroButton extends Mixins(BaseMixin) { } doSendMacro(gcode: string) { - this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) + this.$store.dispatch('server/addEvent', { + message: gcode, + type: 'command', + }) this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'macro_' + gcode }) } sendWithParams() { let params: string[] = [] this.paramArray.forEach((paramname: string) => { - if (this.params[paramname].value !== null && this.params[paramname].value !== '') - params.push(paramname + '=' + this.params[paramname].value) + if (this.params[paramname].value !== null && this.params[paramname].value !== '') { + let tmp: string = paramname + if (paramname.length === 1) tmp += this.params[paramname].value + else tmp += '=' + this.params[paramname].value + + params.push(tmp) + } }) const gcode = this.macro.name + ' ' + params.join(' ')