Fix connect issues with moonraker. Addresses #328

This commit is contained in:
Jordan
2021-11-16 20:59:06 -05:00
parent f6fcb322f5
commit 2f6149c5b7
2 changed files with 11 additions and 2 deletions

View File

@@ -64,6 +64,12 @@ class KlippyWebsocket(threading.Thread):
self.on_open(ws)
try:
state = self._screen.apiclient.get_server_info()
if state is False or state['result']['klippy_connected'] is False:
return False
printer_info = self._screen.apiclient.get_printer_info()
if printer_info is False:
return False
token = self._screen.apiclient.get_oneshot_token()
except Exception:
logging.debug("Unable to get oneshot token")
@@ -160,7 +166,8 @@ class KlippyWebsocket(threading.Thread):
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._callback['on_close'],
"Lost Connection to Moonraker"
"Lost Connection to Moonraker",
True
)
def reconnect(self):