Skip to content

Commit

Permalink
refactor(ExtruderPanel): add _ prefix to gcode_state name (#1989)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Sep 4, 2024
1 parent 21dab39 commit 5cb3080
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/components/panels/Extruder/ExtruderControlPanelControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<template #activator="{ on }">
<div v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:loading="loadings.includes('btnExtrude')"
:disabled="!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly"
small
class="_btn-extruder-cmd"
Expand Down Expand Up @@ -157,7 +157,7 @@
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:loading="loadings.includes('btnExtrude')"
:disabled="
!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly
"
Expand Down Expand Up @@ -263,23 +263,22 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi
}
sendRetract(): void {
const gcode =
`SAVE_GCODE_STATE NAME=ui_retract\n` +
`M83\n` +
`G1 E-${this.feedamount} F${this.feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=ui_retract`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnRetract' })
this.sendCommand(this.feedamount * -1, 'btnRetract')
}
sendExtrude(): void {
this.sendCommand(this.feedamount, 'btnExtrude')
}
sendCommand(length: number, loading: string): void {
const gcode =
`SAVE_GCODE_STATE NAME=ui_extrude\n` +
`SAVE_GCODE_STATE NAME=_ui_extrude\n` +
`M83\n` +
`G1 E${this.feedamount} F${this.feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=ui_extrude`
`G1 E${length} F${this.feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=_ui_extrude`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading })
}
}
</script>
Expand Down

0 comments on commit 5cb3080

Please sign in to comment.