Skip to content

Commit

Permalink
fix: fix issue with cannot extrude after a Klipper restart (#1495)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Jul 30, 2023
1 parent 9eb133b commit cda3098
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/store/printer/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit cda3098

Please sign in to comment.