From a22820fcfae14fa8bed94e7aea64e76e7752de4e Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 1 Sep 2024 23:53:28 +0200 Subject: [PATCH 1/3] refactor(ControlPanel): use SAVE/RESTORE_GCODE_STATE when sending move commands Signed-off-by: Stefan Dej --- src/components/mixins/control.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index 0e669f1a4..1361396de 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -135,9 +135,11 @@ export default class ControlMixin extends Vue { } doSendMove(gcode: string, feedrate: number) { - gcode = 'G91' + '\n' + 'G1 ' + gcode + ' F' + feedrate * 60 - - if (this.absolute_coordinates) gcode += '\nG90' + gcode = + `SAVE_GCODE_STATE NAME=ui_retract\n` + + `G91\n` + + `G1 ${gcode} F${feedrate * 60}\n` + + `RESTORE_GCODE_STATE NAME=ui_retract` this.doSend(gcode) } From dcf0e9f2b47651ef81e95a5f432ab036977d213b Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 1 Sep 2024 23:55:49 +0200 Subject: [PATCH 2/3] fix: fix typo Signed-off-by: Stefan Dej --- src/components/mixins/control.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index 1361396de..155071d7b 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -136,10 +136,10 @@ export default class ControlMixin extends Vue { doSendMove(gcode: string, feedrate: number) { gcode = - `SAVE_GCODE_STATE NAME=ui_retract\n` + + `SAVE_GCODE_STATE NAME=ui_movement\n` + `G91\n` + `G1 ${gcode} F${feedrate * 60}\n` + - `RESTORE_GCODE_STATE NAME=ui_retract` + `RESTORE_GCODE_STATE NAME=ui_movement` this.doSend(gcode) } From cc269d46d520c9450c1dae8c3467901ba23445c8 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 3 Sep 2024 20:50:40 +0200 Subject: [PATCH 3/3] refactor: add '_' prefix to gcode_state name Co-authored-by: Pedro Lamas --- src/components/mixins/control.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index 155071d7b..95db9e2ea 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -136,10 +136,10 @@ export default class ControlMixin extends Vue { doSendMove(gcode: string, feedrate: number) { gcode = - `SAVE_GCODE_STATE NAME=ui_movement\n` + + `SAVE_GCODE_STATE NAME=_ui_movement\n` + `G91\n` + `G1 ${gcode} F${feedrate * 60}\n` + - `RESTORE_GCODE_STATE NAME=ui_movement` + `RESTORE_GCODE_STATE NAME=_ui_movement` this.doSend(gcode) }