From 693929b77ae84855bc14ea60a319bcb7cb4016b9 Mon Sep 17 00:00:00 2001 From: Wondro Date: Tue, 31 Dec 2024 16:34:25 -0600 Subject: [PATCH] feat: Enhance lane actions, spool management, and extruder tools functionality --- .../dialogs/AfcChangeSpoolDialog.vue | 34 ++- .../panels/Afc/AfcExtruderToolsItem.vue | 18 +- .../panels/Afc/AfcUnitsItemLane.vue | 214 ++++++++++++------ src/locales/en.json | 10 +- 4 files changed, 193 insertions(+), 83 deletions(-) diff --git a/src/components/dialogs/AfcChangeSpoolDialog.vue b/src/components/dialogs/AfcChangeSpoolDialog.vue index 0b1aa7e7a..cf49f4508 100644 --- a/src/components/dialogs/AfcChangeSpoolDialog.vue +++ b/src/components/dialogs/AfcChangeSpoolDialog.vue @@ -218,9 +218,13 @@ export default class AfcChangeSpoolDialog extends Mixins(BaseMixin) { this.$nextTick(async () => { try { - await this.$store.dispatch('printer/sendGcode', setColor) - await this.$store.dispatch('printer/sendGcode', setWeight) - await this.$store.dispatch('printer/sendGcode', setMaterial) + this.$socket.emit('printer.gcode.script', { script: setColor }, { loading: 'macro_' + setColor }) + this.$socket.emit('printer.gcode.script', { script: setWeight }, { loading: 'macro_' + setWeight }) + this.$socket.emit( + 'printer.gcode.script', + { script: setMaterial }, + { loading: 'macro_' + setMaterial } + ) } catch (error) { console.error('Failed to send G-code:', error) } @@ -238,9 +242,13 @@ export default class AfcChangeSpoolDialog extends Mixins(BaseMixin) { this.$nextTick(async () => { try { - await this.$store.dispatch('printer/sendGcode', setColor) - await this.$store.dispatch('printer/sendGcode', setWeight) - await this.$store.dispatch('printer/sendGcode', setMaterial) + this.$socket.emit('printer.gcode.script', { script: setColor }, { loading: 'macro_' + setColor }) + this.$socket.emit('printer.gcode.script', { script: setWeight }, { loading: 'macro_' + setWeight }) + this.$socket.emit( + 'printer.gcode.script', + { script: setMaterial }, + { loading: 'macro_' + setMaterial } + ) } catch (error) { console.error('Failed to send G-code:', error) } @@ -273,10 +281,18 @@ export default class AfcChangeSpoolDialog extends Mixins(BaseMixin) { this.$nextTick(async () => { try { - await this.$store.dispatch('printer/sendGcode', setSpoolId) + this.$socket.emit( + 'printer.gcode.script', + { script: setSpoolId }, + { loading: 'macro_' + setSpoolId } + ) console.log('SET_SPOOL_ID sent successfully') - await this.$store.dispatch('printer/sendGcode', unloadLane) + this.$socket.emit( + 'printer.gcode.script', + { script: unloadLane }, + { loading: 'macro_' + unloadLane } + ) console.log('UNLOAD_LANE sent successfully') } catch (error) { console.error('Failed to send G-code:', error) @@ -329,7 +345,7 @@ export default class AfcChangeSpoolDialog extends Mixins(BaseMixin) { this.$nextTick(async () => { try { - await this.$store.dispatch('printer/sendGcode', gcode) + this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'macro_' + gcode }) console.log('G-code sent successfully') } catch (error) { console.error('Failed to send G-code:', error) diff --git a/src/components/panels/Afc/AfcExtruderToolsItem.vue b/src/components/panels/Afc/AfcExtruderToolsItem.vue index a48082020..fc44f2c26 100644 --- a/src/components/panels/Afc/AfcExtruderToolsItem.vue +++ b/src/components/panels/Afc/AfcExtruderToolsItem.vue @@ -13,7 +13,7 @@ }" v-on="on"> - {{ $t('Panels.AfcPanel.PreExtruderSensor') }} + {{ preSensorStatus }} {{ toolName }} @@ -28,7 +28,7 @@ }" v-on="on"> - {{ $t('Panels.AfcPanel.PostExtruderSensor') }} + {{ postSensorStatus }}
{{ tool.buffer }}: {{ tool.buffer_status }}
@@ -52,6 +52,20 @@ import { Extruder } from '@/store/server/afc/types' export default class AfcExtruderToolsItem extends Mixins(BaseMixin) { @Prop({ type: Object, required: true }) readonly tool!: Extruder @Prop({ type: String, required: true }) readonly toolName!: string + + get preSensorStatus(): string { + const status = this.tool.tool_start_sensor + ? this.$t('Panels.AfcPanel.Detected') + : this.$t('Panels.AfcPanel.Empty') + return `${this.$t('Panels.AfcPanel.PreExtruderSensor')} - ${status}` + } + + get postSensorStatus(): string { + const status = this.tool.tool_end_sensor + ? this.$t('Panels.AfcPanel.Detected') + : this.$t('Panels.AfcPanel.Empty') + return `${this.$t('Panels.AfcPanel.PostExtruderSensor')} - ${status}` + } } diff --git a/src/components/panels/Afc/AfcUnitsItemLane.vue b/src/components/panels/Afc/AfcUnitsItemLane.vue index 5747eda41..df267891e 100644 --- a/src/components/panels/Afc/AfcUnitsItemLane.vue +++ b/src/components/panels/Afc/AfcUnitsItemLane.vue @@ -1,34 +1,51 @@