Skip to content

Commit

Permalink
fix: klipper disconnect / shutdown resets printer store
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Bassett <[email protected]>
  • Loading branch information
cadriel committed Mar 21, 2021
1 parent 3fe192f commit c76112c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/store/printer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export const defaultState = (): PrinterState => {
},
configfile: {
save_config_pending: false,
config: {},
config: {
virtual_sdcard: {},
pause_resume: {},
display_status: {},
'gcode_macro CANCEL_PRINT': {}
},
settings: {
bed_mesh: {},
fan: {},
Expand All @@ -38,7 +43,7 @@ export const defaultState = (): PrinterState => {
virtual_sdcard: {},
pause_resume: {},
display_status: {},
'gcode_macro CANCEL_PRINT': {},
'gcode_macro cancel_print': {},
extruder: {
max_extrude_only_velocity: 100,
max_extrude_only_distance: 100
Expand Down
16 changes: 14 additions & 2 deletions src/store/socket/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,23 @@ export const actions: ActionTree<SocketState, RootState> = {
dispatch('console/onAddConsoleEntry', { message: `${Globals.CONSOLE_RECEIVE_PREFIX}${payload}` }, { root: true })
},

async notifyKlippyDisconnected () {
async notifyKlippyDisconnected ({ dispatch }) {
// Partially reset, since config might have changed.
await dispatch('reset', [
'printer',
'charts',
'wait'
], { root: true })
SocketActions.serverInfo()
},

async notifyKlippyShutdown () {
async notifyKlippyShutdown ({ dispatch }) {
// Partially reset, since config might have changed.
await dispatch('reset', [
'printer',
'charts',
'wait'
], { root: true })
SocketActions.serverInfo()
},

Expand Down

0 comments on commit c76112c

Please sign in to comment.