From 3ac57a810be89f8f612e229d7da53298832efa96 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Tue, 3 Sep 2024 10:13:34 +0100 Subject: [PATCH] feat: Restore positioning mode after extrude/move Signed-off-by: Pedro Lamas --- src/components/widgets/toolhead/ExtruderMoves.vue | 12 ++++++++---- .../widgets/toolhead/ToolheadControlBarsAxis.vue | 5 +++-- .../widgets/toolhead/ToolheadControlCircle.vue | 10 +++++++--- .../widgets/toolhead/ToolheadControlCross.vue | 5 +++-- src/components/widgets/toolhead/ToolheadPosition.vue | 6 ++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/components/widgets/toolhead/ExtruderMoves.vue b/src/components/widgets/toolhead/ExtruderMoves.vue index a45f52d388..1c65fc8933 100644 --- a/src/components/widgets/toolhead/ExtruderMoves.vue +++ b/src/components/widgets/toolhead/ExtruderMoves.vue @@ -138,16 +138,20 @@ export default class ExtruderMoves extends Mixins(StateMixin, ToolheadMixin) { sendRetractGcode (amount: number, rate: number, wait?: string) { if (this.valid) { - const gcode = `M83 -G1 E-${amount} F${rate * 60}` + const gcode = `SAVE_GCODE_STATE NAME=_ui_retract +M83 +G1 E-${amount} F${rate * 60} +RESTORE_GCODE_STATE NAME=_ui_retract` this.sendGcode(gcode, wait) } } sendExtrudeGcode (amount: number, rate: number, wait?: string) { if (this.valid) { - const gcode = `M83 -G1 E${amount} F${rate * 60}` + const gcode = `SAVE_GCODE_STATE NAME=_ui_retract +M83 +G1 E${amount} F${rate * 60} +RESTORE_GCODE_STATE NAME=_ui_retract` this.sendGcode(gcode, wait) } } diff --git a/src/components/widgets/toolhead/ToolheadControlBarsAxis.vue b/src/components/widgets/toolhead/ToolheadControlBarsAxis.vue index 5075c242f3..37470ed0cd 100644 --- a/src/components/widgets/toolhead/ToolheadControlBarsAxis.vue +++ b/src/components/widgets/toolhead/ToolheadControlBarsAxis.vue @@ -78,9 +78,10 @@ export default class ToolheadControlBarsAxis extends Mixins(StateMixin, Toolhead } sendMoveGcode (distance: number) { - this.sendGcode(`G91 + this.sendGcode(`SAVE_GCODE_STATE NAME=_ui_movement +G91 G1 ${this.axis}${distance} F${this.rate * 60} -G90`) +RESTORE_GCODE_STATE NAME=_ui_movement`) } sendHomeGcode () { diff --git a/src/components/widgets/toolhead/ToolheadControlCircle.vue b/src/components/widgets/toolhead/ToolheadControlCircle.vue index 020fedbc0e..caf579149c 100644 --- a/src/components/widgets/toolhead/ToolheadControlCircle.vue +++ b/src/components/widgets/toolhead/ToolheadControlCircle.vue @@ -735,9 +735,10 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi : this.$store.state.printer.printer.toolhead.max_accel this.sendGcode(`FORCE_MOVE STEPPER=stepper_${axis.toLowerCase()} DISTANCE=${distance} VELOCITY=${rate} ACCEL=${accel}`) } else { - this.sendGcode(`G91 + this.sendGcode(`SAVE_GCODE_STATE NAME=_ui_movement +G91 G1 ${axis}${distance} F${rate * 60} -G90`) +RESTORE_GCODE_STATE NAME=_ui_movement`) } } @@ -765,7 +766,10 @@ G90`) const bedCenter = this.bedCenter const rate = this.$store.state.config.uiSettings.general.defaultToolheadXYSpeed - this.sendGcode(`G1 X${bedCenter.x} Y${bedCenter.y} F${rate * 60}`) + this.sendGcode(`SAVE_GCODE_STATE NAME=_ui_movement +G90 +G1 X${bedCenter.x} Y${bedCenter.y} F${rate * 60} +RESTORE_GCODE_STATE NAME=_ui_movement`) } } diff --git a/src/components/widgets/toolhead/ToolheadControlCross.vue b/src/components/widgets/toolhead/ToolheadControlCross.vue index 4f4e6e159e..1e186fabc1 100644 --- a/src/components/widgets/toolhead/ToolheadControlCross.vue +++ b/src/components/widgets/toolhead/ToolheadControlCross.vue @@ -258,9 +258,10 @@ export default class ToolheadControlCross extends Mixins(StateMixin, ToolheadMix : this.$store.state.printer.printer.toolhead.max_accel this.sendGcode(`FORCE_MOVE STEPPER=stepper_${axis.toLowerCase()} DISTANCE=${distance} VELOCITY=${rate} ACCEL=${accel}`) } else { - this.sendGcode(`G91 + this.sendGcode(`SAVE_GCODE_STATE NAME=_ui_movement +G91 G1 ${axis}${distance} F${rate * 60} -G90`) +RESTORE_GCODE_STATE NAME=_ui_movement`) } } } diff --git a/src/components/widgets/toolhead/ToolheadPosition.vue b/src/components/widgets/toolhead/ToolheadPosition.vue index 7e976b87e6..37d1d935a1 100644 --- a/src/components/widgets/toolhead/ToolheadPosition.vue +++ b/src/components/widgets/toolhead/ToolheadPosition.vue @@ -174,8 +174,10 @@ export default class ToolheadPosition extends Mixins(StateMixin, ToolheadMixin) : this.$store.state.printer.printer.toolhead.max_accel this.sendGcode(`FORCE_MOVE STEPPER=stepper_${axis.toLowerCase()} DISTANCE=${pos} VELOCITY=${rate} ACCEL=${accel}`) } else { - this.sendGcode(`G90 -G1 ${axis}${pos} F${rate * 60}`) + this.sendGcode(`SAVE_GCODE_STATE NAME=_ui_movement +G90 +G1 ${axis}${pos} F${rate * 60} +RESTORE_GCODE_STATE NAME=_ui_movement`) } } }