forked from mainsail-crew/mainsail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtruderControlPanel.vue
177 lines (158 loc) · 7.52 KB
/
ExtruderControlPanel.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
<panel
v-if="showPanel"
:icon="mdiPrinter3dNozzle"
:title="$t('Panels.ExtruderControlPanel.Headline')"
:collapsible="true"
card-class="extruder-control-panel"
class="pb-1">
<!-- PANEL-HEADER 3-DOT-MENU -->
<template #buttons>
<v-menu v-if="showFilamentMacros" :offset-y="true" :close-on-content-click="false" left>
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" v-on="on">
<v-icon>{{ mdiDotsVertical }}</v-icon>
</v-btn>
</template>
<v-list dense>
<!-- FILAMENT UNLOAD -->
<v-list-item v-if="unloadFilamentMacro">
<v-tooltip top :disabled="canExecuteUnloadMacro" color="secondary">
<template #activator="{ on }">
<div v-on="on">
<macro-button
:macro="unloadFilamentMacro"
:alias="$t('Panels.ExtruderControlPanel.UnloadFilament')"
:disabled="!canExecuteUnloadMacro || printerIsPrintingOnly"
color="#272727" />
</div>
</template>
<span>
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
</v-tooltip>
</v-list-item>
<!-- FILAMENT LOAD -->
<v-list-item v-if="loadFilamentMacro">
<v-tooltip top :disabled="canExecuteLoadMacro" color="secondary">
<template #activator="{ on }">
<div v-on="on">
<macro-button
:macro="loadFilamentMacro"
:alias="$t('Panels.ExtruderControlPanel.LoadFilament')"
:disabled="!canExecuteLoadMacro || printerIsPrintingOnly"
color="#272727" />
</div>
</template>
<span>
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
</v-tooltip>
</v-list-item>
<!-- FILAMENT PURGE -->
<v-list-item v-if="purgeFilamentMacro">
<v-tooltip top :disabled="canExecutePurgeMacro" color="secondary">
<template #activator="{ on }">
<div v-on="on">
<macro-button
:macro="purgeFilamentMacro"
:alias="$t('Panels.ExtruderControlPanel.PurgeFilament')"
:disabled="!canExecutePurgeMacro || printerIsPrintingOnly"
color="#272727" />
</div>
</template>
<span>
{{ $t('Panels.ExtruderControlPanel.ExtruderTempTooLow') }}
{{ minExtrudeTemp }} °C
</span>
</v-tooltip>
</v-list-item>
<!-- NOZZLE CLEAN -->
<v-list-item v-if="cleanNozzleMacro">
<macro-button
:macro="cleanNozzleMacro"
:alias="$t('Panels.ExtruderControlPanel.CleanNozzle')"
:disabled="printerIsPrintingOnly"
color="#272727" />
</v-list-item>
</v-list>
</v-menu>
</template>
<!-- TOOL SELECTOR BUTTONS -->
<extruder-control-panel-tools />
<!-- EXTRUSION FACTOR SLIDER -->
<extrusion-factor-settings />
<!-- PRESSURE ADVANCE SETTINGS -->
<pressure-advance-settings />
<!-- FIRMWARE RETRACTION SETTINGS -->
<firmware-retraction-settings />
<v-divider class="pb-1" />
<!-- EXTRUDER INPUTS AND QUICKSELECTS -->
<extruder-control-panel-control />
<!-- EXTRUSION ESTIMATION NOTE -->
<estimated-extrusion-output />
</panel>
</template>
<script lang="ts">
import { mdiPrinter3dNozzle, mdiDotsVertical } from '@mdi/js'
import { Component, Mixins } from 'vue-property-decorator'
import { PrinterStateExtruder, PrinterStateMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import Panel from '@/components/ui/Panel.vue'
import ExtruderMixin from '@/components/mixins/extruder'
@Component({
components: {
Panel,
},
})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin, ExtruderMixin) {
mdiPrinter3dNozzle = mdiPrinter3dNozzle
mdiDotsVertical = mdiDotsVertical
private heatWaitGcodes = ['printer.extruder.can_extrude', 'TEMPERATURE_WAIT', 'M109']
get showPanel(): boolean {
return this.klipperReadyForGui && this.extruders.length > 0
}
get macros() {
return this.$store.getters['printer/getMacros']
}
get loadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'LOAD_FILAMENT')
}
get unloadFilamentMacro(): PrinterStateMacro | undefined {
return this.macros.find((macro: PrinterStateMacro) => macro.name.toUpperCase() === 'UNLOAD_FILAMENT')
}
get purgeFilamentMacro(): PrinterStateMacro | undefined {
const macros = ['PURGE_FILAMENT', 'FILAMENT_PURGE']
return this.macros.find((macro: PrinterStateMacro) => macros.includes(macro.name.toUpperCase()))
}
get cleanNozzleMacro(): PrinterStateMacro | undefined {
const macros = ['CLEAN_NOZZLE', 'NOZZLE_CLEAN', 'WIPE_NOZZLE', 'NOZZLE_WIPE']
return this.macros.find((macro: PrinterStateMacro) => macros.includes(macro.name.toUpperCase()))
}
/**
* test if the load and unload macro include specific keywords. if true, we allow
* execution of that macro even if at the current time extrudePossible === false
*/
get canExecuteLoadMacro(): boolean {
if (this.extrudePossible) return true
return this.heatWaitGcodes.some((gcode) => this.loadFilamentMacro?.prop.gcode.includes(gcode))
}
get canExecuteUnloadMacro(): boolean {
if (this.extrudePossible) return true
return this.heatWaitGcodes.some((gcode) => this.unloadFilamentMacro?.prop.gcode.includes(gcode))
}
get canExecutePurgeMacro(): boolean {
if (this.extrudePossible) return true
return this.heatWaitGcodes.some((gcode) => this.purgeFilamentMacro?.prop.gcode.includes(gcode))
}
get showFilamentMacros(): boolean {
return this.loadFilamentMacro !== undefined || this.unloadFilamentMacro !== undefined
}
get extruders(): PrinterStateExtruder[] {
return this.$store.getters['printer/getExtruders']
}
}
</script>