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

refactor: add ENABLE=1 to SET_PAUSE_AT_LAYER/NEXT_LAYER #1293

Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions src/components/panels/Status/PauseAtLayerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ export default class StatusPanelPauseAtLayerDialog extends Mixins(BaseMixin) {

sendCommand() {
if (this.type === 'atLayer') {
this.doSend(`SET_PAUSE_AT_LAYER LAYER=${this.layer} MACRO=${this.call}`)
this.doSend(`SET_PAUSE_AT_LAYER ENABLE=1 LAYER=${this.layer} MACRO=${this.call}`)
this.hideDialog()
return
}

this.doSend(`SET_PAUSE_NEXT_LAYER MACRO=${this.call}`)
this.doSend(`SET_PAUSE_NEXT_LAYER ENABLE=1 MACRO=${this.call}`)
this.hideDialog()
}

Expand Down
33 changes: 25 additions & 8 deletions src/components/panels/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<v-col class="py-2">
<span class="subtitle-2 d-block px-0 text--disabled">
<v-icon class="mr-2" small>{{ mdiMessageProcessingOutline }}</v-icon>
{{ print_stats_message ? print_stats_message : display_message }}
{{ print_stats_message ?? display_message }}
</span>
</v-col>
<v-col class="col-auto py-2">
Expand All @@ -83,13 +83,13 @@
<v-divider class="my-0"></v-divider>
<v-tabs-items v-model="activeTab" class="_border-radius">
<v-tab-item v-if="current_filename" value="status">
<status-panel-printstatus></status-panel-printstatus>
<status-panel-printstatus />
</v-tab-item>
<v-tab-item value="files">
<status-panel-gcodefiles></status-panel-gcodefiles>
<status-panel-gcodefiles />
</v-tab-item>
<v-tab-item value="jobqueue">
<status-panel-jobqueue></status-panel-jobqueue>
<status-panel-jobqueue />
</v-tab-item>
</v-tabs-items>
</panel>
Expand Down Expand Up @@ -122,6 +122,7 @@ import {
mdiLayersPlus,
mdiDotsVertical,
} from '@mdi/js'
import { PrinterStateMacro } from '@/store/printer/types'

@Component({
components: {
Expand Down Expand Up @@ -243,7 +244,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {

return ['paused', 'printing'].includes(this.printer_state)
},
click: this.btnExcludeObject,
click: this.btnPauseAtLayer,
},
{
text: this.$t('Panels.StatusPanel.ClearPrintStats'),
Expand Down Expand Up @@ -295,18 +296,18 @@ export default class StatusPanel extends Mixins(BaseMixin) {
click: this.btnExcludeObject,
},
{
text: this.$t('Panels.StatusPanel.PauseAtLayer.PauseAtLayer'),
text: this.$t('Panels.StatusPanel.PauseAtLayer.PauseAtLayer') + ' - ' + this.displayPauseAtLayerButton,
loadingName: 'pauseAtLayer',
icon: mdiLayersPlus,
status: () => this.layer_count !== null,
status: () => this.displayPauseAtLayerButton,
disabled: () => ['paused', 'printing'].includes(this.printer_state),
click: this.btnPauseAtLayer,
},
]
}

get multiFunctionMenuButtonsFiltered() {
return this.multiFunctionMenuButtons.filter((button) => button.status)
return this.multiFunctionMenuButtons.filter((button) => button.status())
}

get multiFunctionButton() {
Expand All @@ -315,6 +316,22 @@ export default class StatusPanel extends Mixins(BaseMixin) {
return this.multiFunctionMenuButtonsFiltered.length > 1
}

get macros() {
return this.$store.getters['printer/getMacros'] ?? []
}

get existsSetPauseAtLayer() {
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_AT_LAYER') !== -1
}

get existsSetPauseNextLayer() {
return this.macros.findIndex((macro: PrinterStateMacro) => macro.name === 'SET_PAUSE_NEXT_LAYER') !== -1
}

get displayPauseAtLayerButton() {
return this.layer_count !== null && (this.existsSetPauseAtLayer || this.existsSetPauseNextLayer)
}

mounted() {
if (this.current_filename !== '') this.activeTab = 'status'
}
Expand Down