Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add buttons for PURGE_FILAMENT and CLEAN_NOZZLE in extruder panel #1641

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/components/panels/ExtruderControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@
</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>
Expand Down Expand Up @@ -106,6 +132,18 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
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
Expand All @@ -122,6 +160,12 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
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
}
Expand Down
2 changes: 2 additions & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@
"Panels": {
"ExtruderControlPanel": {
"Allowed": "Erlaubt",
"CleanNozzle": "Düse reinigen",
"EstimatedExtrusion": "Extrusion:",
"Extrude": "Extrudieren",
"ExtruderTempTooLow": "Extruder Temp. <",
Expand All @@ -555,6 +556,7 @@
"Extruder": "Extruder",
"SmoothTime": "Smooth Time"
},
"PurgeFilament": "Filament reinigen",
"Requested": "Angefordert",
"Retract": "Rückzug",
"TooLargeExtrusion": "Extrusion zu groß!",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@
"Panels": {
"ExtruderControlPanel": {
"Allowed": "Allowed",
"CleanNozzle": "Clean Nozzle",
"EstimatedExtrusion": "Extrusion:",
"Extrude": "Extrude",
"ExtruderTempTooLow": "Extruder temp. <",
Expand All @@ -555,6 +556,7 @@
"Extruder": "Extruder",
"SmoothTime": "Smooth Time"
},
"PurgeFilament": "Purge Filament",
"Requested": "Requested",
"Retract": "Retract",
"TooLargeExtrusion": "Extrusion too large!",
Expand Down
Loading