diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 0ea189907..ff578813a 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -148,7 +148,7 @@ def getSettings(): "triggerOkForM29": s.getBoolean(["serial", "triggerOkForM29"]), "logPositionOnPause": s.getBoolean(["serial", "logPositionOnPause"]), "logPositionOnCancel": s.getBoolean(["serial", "logPositionOnCancel"]), - "supportResendsWithoutOk": s.getBoolean(["serial", "supportResendsWithoutOk"]), + "supportResendsWithoutOk": s.get(["serial", "supportResendsWithoutOk"]), "waitForStart": s.getBoolean(["serial", "waitForStartOnConnect"]), "alwaysSendChecksum": s.getBoolean(["serial", "alwaysSendChecksum"]), "neverSendChecksum": s.getBoolean(["serial", "neverSendChecksum"]), @@ -374,7 +374,10 @@ def _saveSettings(data): if "ignoreErrorsFromFirmware" in data["serial"]: s.setBoolean(["serial", "ignoreErrorsFromFirmware"], data["serial"]["ignoreErrorsFromFirmware"]) if "disconnectOnErrors" in data["serial"]: s.setBoolean(["serial", "disconnectOnErrors"], data["serial"]["disconnectOnErrors"]) if "triggerOkForM29" in data["serial"]: s.setBoolean(["serial", "triggerOkForM29"], data["serial"]["triggerOkForM29"]) - if "supportResendsWithoutOk" in data["serial"]: s.setBoolean(["serial", "supportResendsWithoutOk"], data["serial"]["supportResendsWithoutOk"]) + if "supportResendsWithoutOk" in data["serial"]: + value = data["serial"]["supportResendsWithoutOk"] + if value in ("always", "detect", "never"): + s.set(["serial", "supportResendsWithoutOk"], value) if "waitForStart" in data["serial"]: s.setBoolean(["serial", "waitForStartOnConnect"], data["serial"]["waitForStart"]) if "alwaysSendChecksum" in data["serial"]: s.setBoolean(["serial", "alwaysSendChecksum"], data["serial"]["alwaysSendChecksum"]) if "neverSendChecksum" in data["serial"]: s.setBoolean(["serial", "neverSendChecksum"], data["serial"]["neverSendChecksum"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 9b6606737..6ed1d1bb7 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -98,7 +98,8 @@ default_settings = { "temperature": 5, "temperatureTargetSet": 2, "temperatureAutoreport": 2, - "sdStatus": 1 + "sdStatus": 1, + "resendOk": .5 }, "maxCommunicationTimeouts": { "idle": 2, @@ -114,7 +115,7 @@ default_settings = { "disconnectOnErrors": True, "ignoreErrorsFromFirmware": False, "logResends": True, - "supportResendsWithoutOk": False, + "supportResendsWithoutOk": "detect", "logPositionOnPause": True, "logPositionOnCancel": True, "waitForStartOnConnect": False, @@ -910,7 +911,8 @@ class Settings(object): self._migrate_printer_parameters, self._migrate_gcode_scripts, self._migrate_core_system_commands, - self._migrate_serial_features + self._migrate_serial_features, + self._migrate_resend_without_ok ) for migrate in migrators: @@ -1217,6 +1219,22 @@ class Settings(object): return changed + def _migrate_resend_without_ok(self, config): + """ + Migrates supportResendsWithoutOk flag from boolean to ("always", "detect", "never") value range. + + True gets migrated to "always", False to "detect" (which is the new default). + """ + if "serial" in config and "supportResendsWithoutOk" in config["serial"] \ + and config["serial"]["supportResendsWithoutOk"] not in ("always", "detect", "never"): + value = config["serial"]["supportResendsWithoutOk"] + if value: + config["serial"]["supportResendsWithoutOk"] = "always" + else: + config["serial"]["supportResendsWithoutOk"] = "detect" + return True + return False + def backup(self, suffix, path=None): import shutil diff --git a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 index 5b40eaab8..355c8a023 100644 --- a/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 +++ b/src/octoprint/templates/dialogs/settings/serialconnection.jinja2 @@ -250,17 +250,28 @@ -
ok with their resend requests. Set this to "always" or "if detected as necessary" if you run into communication stalls on resend requests.') }}
+