diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts
index e8a2b2df7..5c9527428 100644
--- a/src/components/mixins/control.ts
+++ b/src/components/mixins/control.ts
@@ -112,6 +112,12 @@ export default class ControlMixin extends Vue {
})
}
+ get existsClientLinearMoveMacro() {
+ const macros = this.$store.state.printer?.gcode?.commands ?? {}
+
+ return '_CLIENT_LINEAR_MOVE' in macros
+ }
+
doHome() {
this.$store.dispatch('server/addEvent', { message: 'G28', type: 'command' })
this.$socket.emit('printer.gcode.script', { script: 'G28' }, { loading: 'homeAll' })
@@ -148,13 +154,27 @@ export default class ControlMixin extends Vue {
}
doSendMove(gcode: string, feedrate: number) {
- gcode =
+ let command =
`SAVE_GCODE_STATE NAME=_ui_movement\n` +
`G91\n` +
`G1 ${gcode} F${feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=_ui_movement`
- this.doSend(gcode)
+ if (this.existsClientLinearMoveMacro) {
+ gcode = gcode
+ .split(' ')
+ .map((part) => {
+ const axis = part.slice(0, 1)
+ const value = parseFloat(part.slice(1))
+
+ return `${axis}=${value}`
+ })
+ .join(' ')
+
+ command = `_CLIENT_LINEAR_MOVE ${gcode} F=${feedrate * 60}`
+ }
+
+ this.doSend(command)
}
doSend(gcode: string) {
diff --git a/src/components/panels/Extruder/ExtruderControlPanelControl.vue b/src/components/panels/Extruder/ExtruderControlPanelControl.vue
index b430f68ab..e43b27372 100644
--- a/src/components/panels/Extruder/ExtruderControlPanelControl.vue
+++ b/src/components/panels/Extruder/ExtruderControlPanelControl.vue
@@ -250,6 +250,12 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi
return this.feedamount * this.extrudeFactor > this.maxExtrudeOnlyDistance
}
+ get existsClientLinearMoveMacro() {
+ const macros = this.$store.state.printer?.gcode?.commands ?? {}
+
+ return '_CLIENT_LINEAR_MOVE' in macros
+ }
+
@Watch('maxExtrudeOnlyDistance', { immediate: true })
onMaxExtrudeOnlyDistanceChange(): void {
/**
@@ -271,12 +277,16 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi
}
sendCommand(length: number, loading: string): void {
- const gcode =
+ let gcode =
`SAVE_GCODE_STATE NAME=_ui_extrude\n` +
`M83\n` +
`G1 E${length} F${this.feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=_ui_extrude`
+ if (this.existsClientLinearMoveMacro) {
+ gcode = `_CLIENT_LINEAR_MOVE E=${length} F=${this.feedrate * 60}`
+ }
+
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading })
}
diff --git a/src/components/panels/ToolheadControls/MoveToControl.vue b/src/components/panels/ToolheadControls/MoveToControl.vue
index 7188be5c9..d55fdb9fa 100644
--- a/src/components/panels/ToolheadControls/MoveToControl.vue
+++ b/src/components/panels/ToolheadControls/MoveToControl.vue
@@ -16,9 +16,7 @@
'col-3': el.is.large,
}"
class="v-subheader text--secondary mr-2">
-
- {{ mdiCrosshairsGps }}
-
+ {{ mdiCrosshairsGps }}
{{ $t('Panels.ToolheadControlPanel.Position') }}:
@@ -27,12 +25,8 @@
@@ -45,7 +39,7 @@
:current-pos="gcodePositions.x"
:readonly="['printing'].includes(printer_state)"
:disabled="!xAxisHomed"
- @submit="sendCmd">
+ @submit="sendCmd" />
+ @submit="sendCmd" />
+ @submit="sendCmd" />
@@ -170,24 +164,44 @@ export default class MoveToControl extends Mixins(BaseMixin, ControlMixin) {
}
sendCmd(): void {
- const xPos = this.input.x.pos !== this.gcodePositions.x ? ` X${this.input.x.pos}` : ''
- const yPos = this.input.y.pos !== this.gcodePositions.y ? ` Y${this.input.y.pos}` : ''
- const zPos = this.input.z.pos !== this.gcodePositions.z ? ` Z${this.input.z.pos}` : ''
+ let gcode: string[] = []
+ if (!this.existsClientLinearMoveMacro) {
+ gcode.push('SAVE_GCODE_STATE NAME=_ui_movement')
+ gcode.push('G90')
+ }
- let gcode = ''
- if (!this.positionAbsolute) {
- gcode += 'G90\n'
+ if (this.input.z.pos !== this.gcodePositions.z) {
+ if (this.existsClientLinearMoveMacro)
+ gcode.push(`_CLIENT_LINEAR_MOVE Z=${this.input.z.pos} F=${this.feedrateZ * 60} ABSOLUTE=1`)
+ else gcode.push(`G1 Z${this.input.z.pos} F${this.feedrateZ * 60}`)
}
- if (zPos !== '') {
- gcode += `G1${zPos} F${this.feedrateZ * 60}\n`
+
+ if (this.input.x.pos !== this.gcodePositions.x || this.input.y.pos !== this.gcodePositions.y) {
+ let xPos = ''
+ let yPos = ''
+
+ if (this.existsClientLinearMoveMacro) {
+ if (this.input.x.pos !== this.gcodePositions.x) xPos = ` X=${this.input.x.pos}`
+ if (this.input.y.pos !== this.gcodePositions.y) yPos = ` Y=${this.input.y.pos}`
+
+ gcode.push(`_CLIENT_LINEAR_MOVE${xPos}${yPos} F=${this.feedrateXY * 60} ABSOLUTE=1`)
+ } else {
+ if (this.input.x.pos !== this.gcodePositions.x) xPos = ` X${this.input.x.pos}`
+ if (this.input.y.pos !== this.gcodePositions.y) yPos = ` Y${this.input.y.pos}`
+
+ gcode.push(`G1${xPos}${yPos} F${this.feedrateXY * 60}`)
+ }
}
- if (xPos !== '' || yPos !== '') {
- gcode += `G1${xPos}${yPos} F${this.feedrateXY * 60}`
+
+ if (!this.existsClientLinearMoveMacro) {
+ gcode.push('RESTORE_GCODE_STATE NAME=_ui_movement')
}
- if (gcode !== '' && this.input.x.valid && this.input.y.valid && this.input.z.valid) {
- this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
- this.$socket.emit('printer.gcode.script', { script: gcode })
+ const gcodeStr = gcode.join('\n')
+
+ if (this.input.x.valid && this.input.y.valid && this.input.z.valid) {
+ this.$store.dispatch('server/addEvent', { message: gcodeStr, type: 'command' })
+ this.$socket.emit('printer.gcode.script', { script: gcodeStr })
}
return