✨ Use low latency flag on serial port
Might improve serial performance. Implements #4099
This commit is contained in:
1 parent
f69ab86524
commit
ae60033551
5 files changed
+26
No files matched your search
@@ -165,6 +165,7 @@ def getSettings():
|
||||
"port": connectionOptions["portPreference"],
|
||||
"baudrate": connectionOptions["baudratePreference"],
|
||||
"exclusive": s.getBoolean(["serial", "exclusive"]),
|
||||
"lowLatency": s.getBoolean(["serial", "lowLatency"]),
|
||||
"portOptions": connectionOptions["ports"],
|
||||
"baudrateOptions": connectionOptions["baudrates"],
|
||||
"autoconnect": s.getBoolean(["serial", "autoconnect"]),
|
||||
@@ -657,6 +658,8 @@ def _saveSettings(data):
|
||||
s.setInt(["serial", "baudrate"], data["serial"]["baudrate"])
|
||||
if "exclusive" in data["serial"]:
|
||||
s.setBoolean(["serial", "exclusive"], data["serial"]["exclusive"])
|
||||
if "lowLatency" in data["serial"]:
|
||||
s.setBoolean(["serial", "lowLatency"], data["serial"]["lowLatency"])
|
||||
if "timeoutConnection" in data["serial"]:
|
||||
s.setFloat(
|
||||
["serial", "timeout", "connection"],
|
||||
|
||||
@@ -110,6 +110,7 @@ default_settings = {
|
||||
"port": None,
|
||||
"baudrate": None,
|
||||
"exclusive": True,
|
||||
"lowLatency": True,
|
||||
"autoconnect": False,
|
||||
"log": False,
|
||||
"timeout": {
|
||||
|
||||
@@ -183,6 +183,7 @@ $(function () {
|
||||
self.serial_port = ko.observable();
|
||||
self.serial_baudrate = ko.observable();
|
||||
self.serial_exclusive = ko.observable();
|
||||
self.serial_lowLatency = ko.observable();
|
||||
self.serial_portOptions = ko.observableArray([]);
|
||||
self.serial_baudrateOptions = ko.observableArray([]);
|
||||
self.serial_autoconnect = ko.observable(undefined);
|
||||
|
||||
@@ -69,6 +69,13 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_lowLatency" id="settings-serialLowLatency"> {{ _('Request low latency mode on the serial port') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Apply parity double open workaround')}}</label>
|
||||
<div class="controls">
|
||||
|
||||
@@ -3685,6 +3685,20 @@ class MachineCom(object):
|
||||
# noinspection PyProtectedMember
|
||||
set_close_exec(serial_obj._port_handle)
|
||||
|
||||
if hasattr(serial_obj, "set_low_latency_mode"):
|
||||
try:
|
||||
serial_obj.set_low_latency_mode(
|
||||
settings().getBoolean(["serial", "lowLatency"])
|
||||
)
|
||||
except Exception:
|
||||
self._logger.exception(
|
||||
"Could not set low latency mode on serial port, continuing without"
|
||||
)
|
||||
else:
|
||||
self._logger.info(
|
||||
"Platform doesn't support low latency mode on serial port"
|
||||
)
|
||||
|
||||
return BufferedReadlineWrapper(serial_obj)
|
||||
|
||||
serial_factories = list(self._serial_factory_hooks.items()) + [
|
||||
|
||||
Reference in new issue
Block a user