🚧 WIP of serial settings migration, part 2
This commit is contained in:
1 parent
6c75ff6c98
commit
369c643ed8
3 files changed
+28
-11
No files matched your search
@@ -197,7 +197,13 @@ class ReprapGcodeProtocol(Protocol, Fdm3dPrinterProtocolMixin, MotorControlProto
|
||||
title=gettext("Ignore"),
|
||||
warning=True,
|
||||
help=gettext("Only choose this if your firmware sends error messages that are not actual errors. Might mask printer issues (even fatal errors!), be careful!"))],
|
||||
default="disconnect")],
|
||||
default="disconnect"),
|
||||
# TODO: implement send_m112 flag
|
||||
BooleanType("send_m112",
|
||||
gettext("Send `M112` on disconnect due to error"),
|
||||
default=True,
|
||||
warning=False,
|
||||
help=gettext("If this is checked, OctoPrint will try to send an `M112` prior to a disconnect due to a (fatal) error in order to disable heaters and motors."))],
|
||||
advanced=True),
|
||||
ParamGroup("pausing",
|
||||
gettext("Pausing"),
|
||||
|
||||
@@ -5,7 +5,7 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from octoprint.comm.transport import Transport, LineAwareTransportWrapper, PushingTransportWrapper
|
||||
from octoprint.comm.util.parameters import TextType, IntegerType, ChoiceType, SuggestionType, BooleanType, Value
|
||||
from octoprint.comm.util.parameters import TextType, IntegerType, ChoiceType, SuggestionType, BooleanType, Value, SmallChoiceType
|
||||
|
||||
from octoprint.util import dummy_gettext as gettext
|
||||
|
||||
@@ -68,7 +68,21 @@ class SerialTransport(Transport):
|
||||
Value(serial.PARITY_EVEN, gettext("even"))],
|
||||
default=serial.PARITY_NONE,
|
||||
advanced=True,
|
||||
expert=True)
|
||||
expert=True),
|
||||
# TODO: implement parity workaround flag
|
||||
SmallChoiceType("parity_workaround",
|
||||
gettext("Apply parity double open workaround"),
|
||||
[Value("always",
|
||||
title=gettext("Always"),
|
||||
help=gettext("Use this if you are running into [this problem](https://forum.arduino.cc/index.php?topic=91291.0).")),
|
||||
Value("detect",
|
||||
title=gettext("If detected as potentially needed")),
|
||||
Value("never",
|
||||
title=gettext("Never"),
|
||||
help=gettext("Use this if connecting to your printer fails with `(22, 'Invalid argument')`."))],
|
||||
default="detect",
|
||||
advanced=True,
|
||||
expert=True)
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1420,6 +1420,7 @@ class Settings(object):
|
||||
protocol_parameters["flavor_overrides"]["send_checksum"] = "never"
|
||||
|
||||
### error handling
|
||||
copy_config_to_profile(["sendM112OnError"], ["error_handling", "send_m112"], config["serial"], protocol_parameters)
|
||||
if "disconnectOnErrors" in config["serial"] or "ignoreErrorsFromFirmware" in config["serial"]:
|
||||
disconnect = config["serial"].get("disconnectOnErrors", True)
|
||||
ignore = config["serial"].get("ignoreErrorsFromFirmware", False)
|
||||
@@ -1479,9 +1480,6 @@ class Settings(object):
|
||||
# TODO: firmwareDetection
|
||||
# TODO: triggerOkForM29
|
||||
|
||||
# TODO: sendM112OnError
|
||||
# TODO: useParityWorkaround
|
||||
|
||||
### logging
|
||||
if "log" in config["serial"]:
|
||||
if not "connection" in config["serial"]:
|
||||
@@ -1498,11 +1496,10 @@ class Settings(object):
|
||||
transport = "virtual"
|
||||
else:
|
||||
transport = SerialTransport.key
|
||||
transport_parameters["port"] = None if port == "AUTO" else port
|
||||
if baudrate:
|
||||
transport_parameters["baudrate"] = baudrate
|
||||
if "exclusive" in config["serial"]:
|
||||
transport_parameters["exclusive"] = config["serial"]["exclusive"]
|
||||
copy_config_to_profile(["port"], ["port"], config["serial"], transport_parameters, converter=lambda x: None if x == "AUTO" else x)
|
||||
copy_config_to_profile(["baudrate"], ["baudrate"], config["serial"], transport_parameters)
|
||||
copy_config_to_profile(["exclusive"], ["exclusive"], config["serial"], transport_parameters)
|
||||
copy_config_to_profile(["useParityWorkaround"], ["parity_workaround"], config["serial"], transport_parameters)
|
||||
|
||||
profile = ConnectionProfile("migrated",
|
||||
name="Migrated from serial settings",
|
||||
|
||||
Reference in new issue
Block a user