From 27e0da90d0404ecb4e3022a90c959966116be113 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 29 Jul 2023 12:58:54 +0200 Subject: [PATCH] fix: fix issue with extruder cannot extrude after a firmware_restart/restart Signed-off-by: Stefan Dej --- 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)