Skip to content

Commit

Permalink
fix(screwsTiltCalculate): use the same direction on retry (#1920)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Jul 6, 2024
1 parent b7a1f4e commit 213ae4b
Showing 1 changed file with 10 additions and 1 deletion.
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>

0 comments on commit 213ae4b

Please sign in to comment.