fix: fix issue with cannot extrude after a Klipper restart (#1495)

This commit is contained in:
Stefan Dej 2023-07-30 21:03:00 +02:00 committed by GitHub
parent 9eb133bd85
commit cda3098c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,6 +71,10 @@ export const actions: ActionTree<PrinterState, RootState> = {
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<PrinterState, RootState> = {
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)