🐛 Change latency mode setting logic

We should only ever attempt to set it if we are supposed
to set it to True. Otherwise there's no need to do
anything really and risk running into issues.

Closes #4203
This commit is contained in:
Gina Häußge committed 2021-08-09 10:04:48 +02:00
1 parent 3a7f539fd5
commit a7d4c5f2df
1 file changed
+11 -12
+11 -12
View File
@@ -3752,19 +3752,18 @@ 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"])
if settings().getBoolean(["serial", "lowLatency"]):
if hasattr(serial_obj, "set_low_latency_mode"):
try:
serial_obj.set_low_latency_mode(True)
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"
)
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)