pause_resume: Perform setup via "klippy:connect" instead of "klippy:ready"

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-04-01 10:10:39 -04:00
parent 74d527776e
commit cdaf9379b0
1 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,8 @@ class PauseResume:
self.is_paused = False self.is_paused = False
self.sd_paused = False self.sd_paused = False
self.pause_command_sent = False self.pause_command_sent = False
self.printer.register_event_handler("klippy:ready", self.handle_ready) self.printer.register_event_handler("klippy:connect",
self.handle_connect)
self.gcode.register_command("PAUSE", self.cmd_PAUSE) self.gcode.register_command("PAUSE", self.cmd_PAUSE)
self.gcode.register_command("RESUME", self.cmd_RESUME) self.gcode.register_command("RESUME", self.cmd_RESUME)
self.gcode.register_command("CLEAR_PAUSE", self.cmd_CLEAR_PAUSE) self.gcode.register_command("CLEAR_PAUSE", self.cmd_CLEAR_PAUSE)
@ -25,7 +26,7 @@ class PauseResume:
self._handle_pause_request) self._handle_pause_request)
webhooks.register_endpoint("pause_resume/resume", webhooks.register_endpoint("pause_resume/resume",
self._handle_resume_request) self._handle_resume_request)
def handle_ready(self): def handle_connect(self):
self.v_sd = self.printer.lookup_object('virtual_sdcard', None) self.v_sd = self.printer.lookup_object('virtual_sdcard', None)
def _handle_cancel_request(self, web_request): def _handle_cancel_request(self, web_request):
self.gcode.run_script("CANCEL_PRINT") self.gcode.run_script("CANCEL_PRINT")