moonraker: replace "check_available" with "check_available_objects"
There "check_available" endpoint no longer exists in Klippy, so use "objects/list" instead. If Klippy is not properly configured Moonraker will log the result. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
0775f3d0c6
commit
6dc43f7e12
|
@ -43,7 +43,6 @@ class Server:
|
||||||
'klippy_uds_address', "/tmp/klippy_uds")
|
'klippy_uds_address', "/tmp/klippy_uds")
|
||||||
self.klippy_iostream = None
|
self.klippy_iostream = None
|
||||||
self.is_klippy_ready = False
|
self.is_klippy_ready = False
|
||||||
self.moonraker_available = False
|
|
||||||
|
|
||||||
# Server/IOLoop
|
# Server/IOLoop
|
||||||
self.server_running = False
|
self.server_running = False
|
||||||
|
@ -189,7 +188,6 @@ class Server:
|
||||||
|
|
||||||
def _handle_stream_closed(self):
|
def _handle_stream_closed(self):
|
||||||
self.is_klippy_ready = False
|
self.is_klippy_ready = False
|
||||||
self.moonraker_available = False
|
|
||||||
self.klippy_iostream = None
|
self.klippy_iostream = None
|
||||||
self.init_cb.stop()
|
self.init_cb.stop()
|
||||||
for request in self.pending_requests.values():
|
for request in self.pending_requests.values():
|
||||||
|
@ -211,14 +209,13 @@ class Server:
|
||||||
|
|
||||||
async def _initialize(self):
|
async def _initialize(self):
|
||||||
await self._request_endpoints()
|
await self._request_endpoints()
|
||||||
if not self.moonraker_available:
|
if not self.is_klippy_ready:
|
||||||
await self._check_available()
|
|
||||||
elif not self.is_klippy_ready:
|
|
||||||
await self._check_ready()
|
await self._check_ready()
|
||||||
else:
|
else:
|
||||||
# Moonraker is enabled in the Klippy module
|
# Moonraker is enabled in the Klippy module
|
||||||
# and Klippy is ready. We can stop the init
|
# and Klippy is ready. We can stop the init
|
||||||
# procedure.
|
# procedure.
|
||||||
|
await self._check_available_objects()
|
||||||
self.init_cb.stop()
|
self.init_cb.stop()
|
||||||
|
|
||||||
async def _request_endpoints(self):
|
async def _request_endpoints(self):
|
||||||
|
@ -234,19 +231,23 @@ class Server:
|
||||||
file_manager = self.lookup_plugin('file_manager')
|
file_manager = self.lookup_plugin('file_manager')
|
||||||
file_manager.update_mutable_paths(mutable_paths)
|
file_manager.update_mutable_paths(mutable_paths)
|
||||||
|
|
||||||
async def _check_available(self):
|
async def _check_available_objects(self):
|
||||||
request = self.make_request(
|
request = self.make_request("objects/list", "GET", {})
|
||||||
"moonraker/check_available", "GET", {})
|
|
||||||
result = await request.wait()
|
result = await request.wait()
|
||||||
if not isinstance(result, ServerError):
|
if not isinstance(result, ServerError):
|
||||||
self.moonraker_available = True
|
missing_objs = []
|
||||||
|
for obj in ["virtual_sdcard", "display_status", "pause_resume"]:
|
||||||
|
if obj not in result:
|
||||||
|
missing_objs.append(obj)
|
||||||
|
if missing_objs:
|
||||||
|
err_str = ", ".join([f"[{o}]" for o in missing_objs])
|
||||||
|
logging.info(
|
||||||
|
f"\nWarning, unable to detect the following printer "
|
||||||
|
f"objects:\n{err_str}\nPlease add the the above sections "
|
||||||
|
f"to printer.cfg for full Moonraker functionality.")
|
||||||
else:
|
else:
|
||||||
logging.info(
|
logging.info(
|
||||||
"%s\nUnable to detect Moonraker compatibility in Klipper.\n "
|
"%s\nUnable to retreive Klipper Object List " % (str(result)))
|
||||||
"Repeated failures may indicate that the [moonraker] section\n "
|
|
||||||
"has not been added to printer.cfg. This may also indicate\n"
|
|
||||||
"that Klippy has experienced an error during startup. Check\n"
|
|
||||||
"klippy.log for more info." % (str(result)))
|
|
||||||
|
|
||||||
async def _check_ready(self):
|
async def _check_ready(self):
|
||||||
request = self.make_request("info", "GET", {})
|
request = self.make_request("info", "GET", {})
|
||||||
|
|
Loading…
Reference in New Issue