✨ New action commands for SD signaling

This commit is contained in:
Gina Häußge committed 2021-03-16 11:34:17 +01:00
1 parent a24d3f26ae
commit 91733d314f
2 files changed
+34

No files matched your search

+21
View File
@@ -54,6 +54,27 @@ resumed
disconnect
When this command is received from the printer, OctoPrint will immediately disconnect from it.
sd_inserted
When this command is received from the printer, OctoPrint will assume an SD card is present in the printer,
set the corresponding internal state flags and send a file list request. This command is only recognized
if SD support is enabled in OctoPrint.
.. versionadded:: 1.6.0
sd_ejected
When this command is received from the printer, OctoPrint will assume the SD card has been removed from
the printer and clear the corresponding internal state flags. This command is only recognized
if SD support is enabled in OctoPrint.
.. versionadded:: 1.6.0
sd_updated
When this command is received from the printer, OctoPrint will assume something on the SD card in the
printer has changed and trigger a file list request. This command is only recognized
if SD support is enabled in OctoPrint.
.. versionadded:: 1.6.0
If the bundled :ref:`Action Command Prompt Support Plugin <sec-bundledplugins-action_command_prompt>` is enabled (which
should be the case by default), OctoPrint will also interactive dialog creation through its :ref:`supported commands <sec-bundledplugins-action_command_prompt-action_commands>`.
+13
View File
@@ -2288,6 +2288,19 @@ class MachineCom(object):
elif action_name == "disconnect":
self._log("Disconnecting on request of the printer...")
self._callback.on_comm_force_disconnect()
elif self._sdEnabled and action_name == "sd_inserted":
self._log("Printer reported SD card as inserted")
self._sdAvailable = True
self.refreshSdFiles()
self._callback.on_comm_sd_state_change(self._sdAvailable)
elif self._sdEnabled and action_name == "sd_ejected":
self._log("Printer reported SD card as ejected")
self._sdAvailable = False
self._sdFiles = []
self._callback.on_comm_sd_state_change(self._sdAvailable)
elif self._sdEnabled and action_name == "sd_updated":
self._log("Printer reported a change on the SD card")
self.refreshSdFiles()
else:
for name, hook in self._printer_action_hooks.items():
try: