From cda3098c9e09a054aa7baa69a3195e0a73f43e54 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 30 Jul 2023 21:03:00 +0200 Subject: [PATCH] fix: fix issue with cannot extrude after a Klipper restart (#1495) --- src/store/printer/actions.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/store/printer/actions.ts b/src/store/printer/actions.ts index 64145e940..8a89be88e 100644 --- a/src/store/printer/actions.ts +++ b/src/store/printer/actions.ts @@ -71,6 +71,10 @@ export const actions: ActionTree = { dispatch('getData', payload) Vue.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' }) + + setTimeout(() => { + dispatch('initExtruderCanExtrude') + }, 200) }, getData({ commit, dispatch, state }, payload) { @@ -125,6 +129,17 @@ export const actions: ActionTree = { commit('setData', payload) }, + initExtruderCanExtrude({ state }) { + const extruderList: string[] = Object.keys(state).filter((name) => name.startsWith('extruder')) + const reInitList: { [key: string]: string[] } = {} + + extruderList.forEach((extruderName) => { + reInitList[extruderName] = ['can_extrude'] + }) + + Vue.$socket.emit('printer.objects.query', { objects: reInitList }, { action: 'printer/getData' }) + }, + initHelpList({ commit, dispatch }, payload) { commit('setHelplist', payload)