diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index cc7e0e574..3a61c97cd 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -172,6 +172,7 @@ def getSettings(): "ignoreIdenticalResends": s.getBoolean(["serial", "ignoreIdenticalResends"]), "firmwareDetection": s.getBoolean(["serial", "firmwareDetection"]), "blockWhileDwelling": s.getBoolean(["serial", "blockWhileDwelling"]), + "useParityWorkaround": s.get(["serial", "useParityWorkaround"]), "maxTimeoutsIdle": s.getInt(["serial", "maxCommunicationTimeouts", "idle"]), "maxTimeoutsPrinting": s.getInt(["serial", "maxCommunicationTimeouts", "printing"]), "maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"]), @@ -459,6 +460,10 @@ def _saveSettings(data): if "ignoreIdenticalResends" in data["serial"]: s.setBoolean(["serial", "ignoreIdenticalResends"], data["serial"]["ignoreIdenticalResends"]) if "firmwareDetection" in data["serial"]: s.setBoolean(["serial", "firmwareDetection"], data["serial"]["firmwareDetection"]) if "blockWhileDwelling" in data["serial"]: s.setBoolean(["serial", "blockWhileDwelling"], data["serial"]["blockWhileDwelling"]) + if "useParityWorkaround" in data["serial"]: + value = data["serial"]["useParityWorkaround"] + if value in ("always", "detect", "never"): + s.set(["serial", "useParityWorkaround"], value) if "logPositionOnPause" in data["serial"]: s.setBoolean(["serial", "logPositionOnPause"], data["serial"]["logPositionOnPause"]) if "logPositionOnCancel" in data["serial"]: s.setBoolean(["serial", "logPositionOnCancel"], data["serial"]["logPositionOnCancel"]) if "abortHeatupOnCancel" in data["serial"]: s.setBoolean(["serial", "abortHeatupOnCancel"], data["serial"]["abortHeatupOnCancel"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 74dd986d6..5a29d99fa 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -144,6 +144,7 @@ default_settings = { "supportFAsCommand": False, "firmwareDetection": True, "blockWhileDwelling": False, + "useParityWorkaround": "detect", "capabilities": { "autoreport_temp": True, diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index cb4b3caaa..8a0c29455 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -185,6 +185,7 @@ $(function() { self.serial_ignoreIdenticalResends = ko.observable(undefined); self.serial_firmwareDetection = ko.observable(undefined); self.serial_blockWhileDwelling = ko.observable(undefined); + self.serial_useParityWorkaround = ko.observable(undefined); self.serial_supportResendsWithoutOk = ko.observable(undefined); self.serial_logPositionOnPause = ko.observable(undefined); self.serial_logPositionOnCancel = ko.observable(undefined); diff --git a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 index b180c8ddb..c3b6b019a 100644 --- a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 +++ b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 @@ -33,7 +33,7 @@
- {{ _('Use this to define additional glob patterns matching serial ports to list for connecting against, e.g. /dev/ttyAMA*. One entry per line.')|format(glob_url="http://docs.python.org/2/library/glob.html") }} + {{ _('Use this to define additional glob patterns matching serial ports to list for connecting against, e.g. /dev/ttyAMA*. One entry per line. Please note that ports will only be offered to connect to if they get also detected by the operating system. Adding a port here will not make it magically appear in OctoPrint. If the operating system doesn\'t see your printer you need to solve this first.')|format(glob_url="http://docs.python.org/2/library/glob.html") }}
@@ -51,6 +51,22 @@
+
+ +
+ + + +
+
{{ _('Serial logging') }} diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 97b3d360e..bb9563eb3 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2625,14 +2625,15 @@ class MachineCom(object): serial_obj = serial.Serial(**serial_port_args) serial_obj.port = str(port) - # This may also not be applicable to other platforms, in which case - # this should probably get rewritten as a whitelist for the platforms - # that have issues here. - if get_os() != 'freebsd': + use_parity_workaround = settings().get(["serial", "useParityWorkaround"]) + needs_parity_workaround = True #get_os() == "linux" and os.path.exists("/etc/debian_version") # See #673 + + if use_parity_workaround == "always" or (needs_parity_workaround and use_parity_workaround == "detect"): serial_obj.parity = serial.PARITY_ODD serial_obj.open() serial_obj.close() serial_obj.parity = serial.PARITY_NONE + serial_obj.open() return BufferedReadlineWrapper(serial_obj)