Skip to content

Commit

Permalink
feat: Restore positioning mode after extrude/move
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas committed Sep 8, 2024
1 parent 62fe156 commit 3ac57a8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
12 changes: 8 additions & 4 deletions src/components/widgets/toolhead/ExtruderMoves.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/widgets/toolhead/ToolheadControlBarsAxis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
10 changes: 7 additions & 3 deletions src/components/widgets/toolhead/ToolheadControlCircle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
}
Expand Down Expand Up @@ -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`)
}
}
</script>
Expand Down
5 changes: 3 additions & 2 deletions src/components/widgets/toolhead/ToolheadControlCross.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/widgets/toolhead/ToolheadPosition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
}
}
Expand Down

0 comments on commit 3ac57a8

Please sign in to comment.