✨ Add setting for exclusive comm port flag
Just in case there are issues with that on some setups as first RC seem to indicate, we make it toggleable.
This commit is contained in:
1 parent
967b3bbff8
commit
e2519abbbe
5 files changed
+18
-4
No files matched your search
@@ -130,6 +130,7 @@ def getSettings():
|
||||
"serial": {
|
||||
"port": connectionOptions["portPreference"],
|
||||
"baudrate": connectionOptions["baudratePreference"],
|
||||
"exclusive": s.getBoolean(["serial", "exclusive"]),
|
||||
"portOptions": connectionOptions["ports"],
|
||||
"baudrateOptions": connectionOptions["baudrates"],
|
||||
"autoconnect": s.getBoolean(["serial", "autoconnect"]),
|
||||
@@ -419,6 +420,7 @@ def _saveSettings(data):
|
||||
if "autoconnect" in data["serial"]: s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"])
|
||||
if "port" in data["serial"]: s.set(["serial", "port"], data["serial"]["port"])
|
||||
if "baudrate" in data["serial"]: s.setInt(["serial", "baudrate"], data["serial"]["baudrate"])
|
||||
if "exclusive" in data["serial"]: s.setBoolean(["serial", "exclusive"], data["serial"]["exclusive"])
|
||||
if "timeoutConnection" in data["serial"]: s.setFloat(["serial", "timeout", "connection"], data["serial"]["timeoutConnection"], min=1.0)
|
||||
if "timeoutDetection" in data["serial"]: s.setFloat(["serial", "timeout", "detection"], data["serial"]["timeoutDetection"], min=1.0)
|
||||
if "timeoutCommunication" in data["serial"]: s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunication"], min=1.0)
|
||||
|
||||
@@ -88,6 +88,7 @@ default_settings = {
|
||||
"serial": {
|
||||
"port": None,
|
||||
"baudrate": None,
|
||||
"exclusive": True,
|
||||
"autoconnect": False,
|
||||
"log": False,
|
||||
"timeout": {
|
||||
|
||||
@@ -149,6 +149,7 @@ $(function() {
|
||||
|
||||
self.serial_port = ko.observable();
|
||||
self.serial_baudrate = ko.observable();
|
||||
self.serial_exclusive = ko.observable();
|
||||
self.serial_portOptions = ko.observableArray([]);
|
||||
self.serial_baudrateOptions = ko.observableArray([]);
|
||||
self.serial_autoconnect = ko.observable(undefined);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="settings_serial_general" class="tab-pane active">
|
||||
<fieldset>
|
||||
<fieldset id="settings_serial_general_connection">
|
||||
<legend>{{ _('Connection') }}</legend>
|
||||
<div class="control-group" title="{{ _('Serial port to connect to, setting this to AUTO will make OctoPrint try to automatically find the right setting') }}">
|
||||
<label class="control-label" for="settings-serialPort">{{ _('Serial Port') }}</label>
|
||||
@@ -43,8 +43,16 @@
|
||||
<span class="help-inline">{{ _('Use this to define additional serial port baud rates to list for connecting with, e.g. <code>123456</code>. Comma separated.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_exclusive" id="settings-serialExclusive"> {{ _('Request exclusive access to the serial port') }}
|
||||
<span class="help-block">{{ _('Uncheck this if you are having problems connecting to your printer.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<fieldset id="settings_serial_general_logging">
|
||||
<legend>{{ _('Serial logging') }}</legend>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
|
||||
@@ -2591,10 +2591,12 @@ class MachineCom(object):
|
||||
"baudrate": baudrateList()[0] if baudrate == 0 else baudrate,
|
||||
"timeout": read_timeout,
|
||||
"write_timeout": 0,
|
||||
"parity": serial.PARITY_ODD,
|
||||
"exclusive": True
|
||||
"parity": serial.PARITY_ODD
|
||||
}
|
||||
|
||||
if settings().getBoolean(["serial", "exclusive"]):
|
||||
serial_port_args["exclusive"] = True
|
||||
|
||||
serial_obj = serial.Serial(**serial_port_args)
|
||||
|
||||
serial_obj.close()
|
||||
|
||||
Reference in new issue
Block a user