From 0171f2bb7d4fb7da0e2d783c6132c0913a3cafa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 16 Feb 2022 16:08:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Expose=20unknown=20command=20treatm?= =?UTF-8?q?ent=20on=20UI=20&=20add=20auto=20detection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prusa Firmware now has sendChecksumWithUnknownCommands and unknownCommandsNeedAck as they've decided to add non-GCODE commands to their MMU command subset that otherwise possibly cause issues in the field, especially if part of a sliced file. Implements #4423 --- src/octoprint/server/api/settings.py | 4 ++++ .../static/js/app/viewmodels/settings.js | 2 ++ .../dialogs/settings/serialconnection.jinja2 | 21 +++++++++++++++++-- src/octoprint/util/comm.py | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index b81c92b3b..c48642a70 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -216,6 +216,10 @@ def getSettings(): "waitForStart": s.getBoolean(["serial", "waitForStartOnConnect"]), "alwaysSendChecksum": s.getBoolean(["serial", "alwaysSendChecksum"]), "neverSendChecksum": s.getBoolean(["serial", "neverSendChecksum"]), + "sendChecksumWithUnknownCommands": s.getBoolean( + ["serial", "sendChecksumWithUnknownCommands"] + ), + "unknownCommandsNeedAck": s.getBoolean(["serial", "unknownCommandsNeedAck"]), "sdRelativePath": s.getBoolean(["serial", "sdRelativePath"]), "sdAlwaysAvailable": s.getBoolean(["serial", "sdAlwaysAvailable"]), "sdLowerCase": s.getBoolean(["serial", "sdLowerCase"]), diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index c7df6406f..5ae24af21 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -219,6 +219,8 @@ $(function () { self.serial_triggerOkForM29 = ko.observable(undefined); self.serial_waitForStart = ko.observable(undefined); self.serial_sendChecksum = ko.observable("print"); + self.serial_sendChecksumWithUnknownCommands = ko.observable(undefined); + self.serial_unknownCommandsNeedAck = ko.observable(undefined); self.serial_sdRelativePath = ko.observable(undefined); self.serial_sdLowerCase = ko.observable(undefined); self.serial_sdAlwaysAvailable = ko.observable(undefined); diff --git a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 index 3d7bd971e..8e3b50cd3 100644 --- a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 +++ b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 @@ -343,7 +343,23 @@ - +
+
+ +
+
+
+
+ +
+
+
{{ _('Advanced options') }}
@@ -457,7 +473,8 @@
- {{ _('Use this to specify emergency commands which should jump any queues and - if supported by the firmware - be force sent. Just the G or M code, comma separated. Defaults to M112, M108 and M410.') }}
+ {{ _('Use this to specify emergency commands which should jump any queues and - if supported by the firmware - be force sent. Just the G or M code, comma separated. Defaults to M112, M108 and M410.') }} +
{{ _('Advanced options') }}
diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index c197f0c1c..7feef5bb6 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2819,6 +2819,8 @@ class MachineCom: ) self._sdLowerCase = True + self._sendChecksumWithUnknownCommands = True + self._unknownCommandsNeedAck = True self._firmware_info_received = True self._firmware_info = data