From 6d3b1b7f131e15e465b9419c83536a0dd7083c1f Mon Sep 17 00:00:00 2001 From: Nicanor Romero Venier Date: Wed, 26 Aug 2015 17:55:34 +0200 Subject: [PATCH 1/3] Added possibility of never sending checksums Within the settings/features there is now a block of radio buttons where the user can select whether to send checksums only when printing, always or never. In order to maintain backward compatibility in the settings, this is stored in two variables, alwaysSendChecksum and neverSendChecksum. If both are False, it is assumed that checksums are sent only when printing, being this the default value. --- src/octoprint/server/api/settings.py | 2 ++ src/octoprint/settings.py | 1 + .../static/js/app/viewmodels/settings.js | 10 ++++++--- .../dialogs/settings/features.jinja2 | 21 ++++++++++++------- src/octoprint/util/comm.py | 3 ++- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 78858407..ff48336c 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -63,6 +63,7 @@ def getSettings(): "temperatureGraph": s.getBoolean(["feature", "temperatureGraph"]), "waitForStart": s.getBoolean(["feature", "waitForStartOnConnect"]), "alwaysSendChecksum": s.getBoolean(["feature", "alwaysSendChecksum"]), + "neverSendChecksum": s.getBoolean(["feature", "neverSendChecksum"]), "sdSupport": s.getBoolean(["feature", "sdSupport"]), "sdAlwaysAvailable": s.getBoolean(["feature", "sdAlwaysAvailable"]), "swallowOkAfterResend": s.getBoolean(["feature", "swallowOkAfterResend"]), @@ -211,6 +212,7 @@ def _saveSettings(data): if "temperatureGraph" in data["feature"].keys(): s.setBoolean(["feature", "temperatureGraph"], data["feature"]["temperatureGraph"]) if "waitForStart" in data["feature"].keys(): s.setBoolean(["feature", "waitForStartOnConnect"], data["feature"]["waitForStart"]) if "alwaysSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "alwaysSendChecksum"], data["feature"]["alwaysSendChecksum"]) + if "neverSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "neverSendChecksum"], data["feature"]["neverSendChecksum"]) if "sdSupport" in data["feature"].keys(): s.setBoolean(["feature", "sdSupport"], data["feature"]["sdSupport"]) if "sdAlwaysAvailable" in data["feature"].keys(): s.setBoolean(["feature", "sdAlwaysAvailable"], data["feature"]["sdAlwaysAvailable"]) if "swallowOkAfterResend" in data["feature"].keys(): s.setBoolean(["feature", "swallowOkAfterResend"], data["feature"]["swallowOkAfterResend"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 2419b8e4..2181c834 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -143,6 +143,7 @@ default_settings = { "temperatureGraph": True, "waitForStartOnConnect": False, "alwaysSendChecksum": False, + "neverSendChecksum": False, "sendChecksumWithUnknownCommands": False, "unknownCommandsNeedAck": False, "sdSupport": True, diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index 561fbb5a..ea485b45 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -113,7 +113,7 @@ $(function() { self.feature_gcodeViewer = ko.observable(undefined); self.feature_temperatureGraph = ko.observable(undefined); self.feature_waitForStart = ko.observable(undefined); - self.feature_alwaysSendChecksum = ko.observable(undefined); + self.feature_sendChecksum = ko.observable("print"); self.feature_sdSupport = ko.observable(undefined); self.feature_sdAlwaysAvailable = ko.observable(undefined); self.feature_swallowOkAfterResend = ko.observable(undefined); @@ -525,7 +525,9 @@ $(function() { // some special read functions for various observables var specialMappings = { feature: { - externalHeatupDetection: function() { return !self.feature_disableExternalHeatupDetection() } + externalHeatupDetection: function() { return !self.feature_disableExternalHeatupDetection()}, + alwaysSendChecksum: function() { return self.feature_sendChecksum() == "always"}, + neverSendChecksum: function() { return self.feature_sendChecksum() == "never"} }, serial: { additionalPorts : function() { return commentableLinesToArray(self.serial_additionalPorts()) }, @@ -614,7 +616,9 @@ $(function() { } }, feature: { - externalHeatupDetection: function(value) { self.feature_disableExternalHeatupDetection(!value) } + externalHeatupDetection: function(value) { self.feature_disableExternalHeatupDetection(!value) }, + alwaysSendChecksum: function(value) { if (value) { self.feature_sendChecksum("always")}}, + neverSendChecksum: function(value) { if (value) { self.feature_sendChecksum("never")}} }, serial: { additionalPorts : function(value) { self.serial_additionalPorts(value.join("\n"))}, diff --git a/src/octoprint/templates/dialogs/settings/features.jinja2 b/src/octoprint/templates/dialogs/settings/features.jinja2 index 97a5864f..abb0c38a 100644 --- a/src/octoprint/templates/dialogs/settings/features.jinja2 +++ b/src/octoprint/templates/dialogs/settings/features.jinja2 @@ -41,13 +41,6 @@ -
-
- -
-
+
+ +
+ + + +
+
diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 5e03842a..719f5b2a 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -240,6 +240,7 @@ class MachineCom(object): self._hello_command = settings().get(["serial", "helloCommand"]) self._alwaysSendChecksum = settings().getBoolean(["feature", "alwaysSendChecksum"]) + self._neverSendChecksum = settings().getBoolean(["feature", "neverSendChecksum"]) self._sendChecksumWithUnknownCommands = settings().getBoolean(["feature", "sendChecksumWithUnknownCommands"]) self._unknownCommandsNeedAck = settings().getBoolean(["feature", "unknownCommandsNeedAck"]) self._currentLine = 1 @@ -1617,7 +1618,7 @@ class MachineCom(object): # now comes the part where we increase line numbers and send stuff - no turning back now command_requiring_checksum = gcode is not None and gcode in self._checksum_requiring_commands command_allowing_checksum = gcode is not None or self._sendChecksumWithUnknownCommands - checksum_enabled = self.isPrinting() or self._alwaysSendChecksum + checksum_enabled = self._alwaysSendChecksum or (self.isPrinting() and not self._neverSendChecksum) if command_requiring_checksum or (command_allowing_checksum and checksum_enabled): linenumber = self._currentLine From b4bb54aca680550396b2d5c19350b697073af47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 27 Aug 2015 13:14:27 +0200 Subject: [PATCH 2/3] Changelog entry for implementation of #949 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eabc7b99..535e7b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ will actually get sent. * Additional baud rates to allow for connecting can now be specified along side additional serial ports via the settings dialog and the configuration file. +* Option to never send checksums (e.g. if the printer firmware doesn't support it), + see [#949](https://github.com/foosel/OctoPrint/issues/949). * Documentation improvements ### Bug Fixes From 51b1535a298018f774d546f8e4b531a76db968e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 27 Aug 2015 16:43:58 +0200 Subject: [PATCH 3/3] Make sure stdout is a string when we try to treat it as such... --- .../plugins/softwareupdate/scripts/update-octoprint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py b/src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py index b12f1729..54df463c 100644 --- a/src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py +++ b/src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py @@ -93,7 +93,8 @@ def _git(args, cwd, verbose=False, git_executable=None): for c in commands: try: - return _execute([c] + args, cwd=cwd) + returncode, stdout, stderr = _execute([c] + args, cwd=cwd) + return returncode, "\n".join(stdout), "\n".join(stderr) except EnvironmentError: e = sys.exc_info()[1] if e.errno == errno.ENOENT: