From 9f2ccd81ce8f018f30c564dbd982513c190098b0 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 23 Jun 2024 21:38:24 +0200 Subject: [PATCH] fix(screwsTiltCalculate): use the same direction on retry Signed-off-by: Stefan Dej --- src/components/dialogs/TheScrewsTiltAdjustDialog.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/dialogs/TheScrewsTiltAdjustDialog.vue b/src/components/dialogs/TheScrewsTiltAdjustDialog.vue index fb16ba235..038ca115d 100644 --- a/src/components/dialogs/TheScrewsTiltAdjustDialog.vue +++ b/src/components/dialogs/TheScrewsTiltAdjustDialog.vue @@ -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 }, }) @@ -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') } }