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

fix(screwsTiltCalculate): use the same direction on retry #1920

Merged
Merged
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
11 changes: 10 additions & 1 deletion src/components/dialogs/TheScrewsTiltAdjustDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import SettingsRow from '@/components/settings/SettingsRow.vue'
import { mdiArrowCollapseDown, mdiCloseThick } from '@mdi/js'
import ControlMixin from '@/components/mixins/control'
import TheScrewsTiltAdjustDialogEntry from '@/components/dialogs/TheScrewsTiltAdjustDialogEntry.vue'
import { ServerStateEvent } from '@/store/server/types'
@Component({
components: { TheScrewsTiltAdjustDialogEntry, Panel, Responsive, SettingsRow },
})
Expand Down Expand Up @@ -92,9 +93,17 @@ export default class TheScrewsTiltAdjustDialog extends Mixins(BaseMixin, Control
}

async retryScrewsTiltAdjust() {
const entries = [...(this.$store.state.server.events ?? [])]
const lastCommand = entries
.reverse()
.find(
(entry: ServerStateEvent) =>
entry.type === 'command' && entry.message.startsWith('SCREWS_TILT_CALCULATE')
)

await this.$store.dispatch('printer/clearScrewsTiltAdjust')

this.doSend('SCREWS_TILT_CALCULATE')
this.doSend(lastCommand?.message ?? 'SCREWS_TILT_CALCULATE')
}
}
</script>
Loading