diff --git a/.versioneer-lookup b/.versioneer-lookup index b03660e7..ed09d158 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -16,14 +16,14 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.3.4 +# maintenance is currently the branch for preparation of maintenance release 1.3.5 # so are any fix/... and improve/... branches -maintenance 1.3.4 b55c4ef5ca5b96ec4274bf8ebe3ca51439003128 pep440-dev -fix/.* 1.3.4 b55c4ef5ca5b96ec4274bf8ebe3ca51439003128 pep440-dev -improve/.* 1.3.4 b55c4ef5ca5b96ec4274bf8ebe3ca51439003128 pep440-dev +maintenance 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev +fix/.* 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev +improve/.* 1.3.5 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.3.4rc1 -staging/maintenance 1.3.4rc1 b55c4ef5ca5b96ec4274bf8ebe3ca51439003128 pep440-dev +# staging/maintenance is currently the branch for preparation of 1.3.5rc1 +staging/maintenance 1.3.5rc1 fe481e12b3c50a2def3b41515200e13a8c6a5c72 pep440-dev # every other branch is a development branch and thus gets resolved to 1.4.0-dev for now .* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev diff --git a/CHANGELOG.md b/CHANGELOG.md index 88731fe2..3a36cf58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # OctoPrint Changelog +## 1.3.4 (2017-06-01) + +### Note for owners of Malyan M200/Monoprice Select Mini + +OctoPrint's firmware autodetection is now able to detect this printer. Currently when this printer is detected, the following firmware specific features will be enabled automatically: + + * Always assume SD card is present (`feature.sdAlwaysAvailable`) + * Send a checksum with the command: Always (`feature.alwaysSendChecksum`) + +Since the firmware is a very special kind of beast and its sources are so far unavailable, only tests with a real printer will show if those are sufficient settings for communication with this printer to fully function correctly. Thus, if you run into any issues with enabled firmware autodetection on this printer model, please add a comment in [#1762](https://github.com/foosel/OctoPrint/issues/1762) and explain what kind of communication problem you are seeing. Also make sure to include a [`serial.log`](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#where-can-i-find-those-log-files-you-keep-talking-about)! + +### Bug fixes + + * [#1942](https://github.com/foosel/OctoPrint/issues/1942) - Fixed crash on startup in case of an invalid default printer profile combined with "auto-connect on startup" being selected and the printer available to connect to. + +### More information + + * [Commits](https://github.com/foosel/OctoPrint/compare/1.3.1...1.3.2) + * Release Candidates: + * None since this constitutes a hotfix release to fix an apparently very rare bug introduced with 1.3.3 that seems to be affecting a small number of users. + ## 1.3.3 (2017-05-31) ### Note for owners of Malyan M200/Monoprice Select Mini diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 5b3f4b48..fb9493c6 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -215,12 +215,18 @@ class PrinterProfileManager(object): if self.exists("_default"): return + if not isinstance(default_overrides, dict): + self._logger.warn("Existing default profile from settings is not a valid profile, refusing to migrate: {!r}".format(default_overrides)) + return + default_overrides["id"] = "_default" self.save(default_overrides) settings().set(["printerProfiles", "defaultProfile"], None) settings().save() + self._logger.info("Migrated default printer profile from settings to _default.profile: {!r}".format(default_overrides)) + def _verify_default_available(self): default_id = settings().get(["printerProfile", "default"]) if default_id is None: @@ -228,12 +234,23 @@ class PrinterProfileManager(object): if not self.exists(default_id): if not self.exists("_default"): - self._logger.error("Selected default profile {} and _default do not exist, creating _default again and setting it as default".format(default_id)) + if default_id == "_default": + self._logger.error("Profile _default does not exist, creating _default again and setting it as default") + else: + self._logger.error("Selected default profile {} and _default do not exist, creating _default again and setting it as default".format(default_id)) self.save(self.__class__.default, allow_overwrite=True, make_default=True) else: self._logger.error("Selected default profile {} does not exists, resetting to _default".format(default_id)) settings().set(["printerProfiles", "default"], "_default") settings().save() + default_id = "_default" + + profile = self.get(default_id) + if profile is None: + self._logger.error("Selected default profile {} is invalid, resetting to default values".format(default_id)) + profile = copy.deepcopy(self.__class__.default) + profile["id"] = default_id + self.save(self.__class__.default, allow_overwrite=True, make_default=True) def select(self, identifier): if identifier is None or not self.exists(identifier): @@ -241,7 +258,12 @@ class PrinterProfileManager(object): return False else: self._current = self.get(identifier) - return True + if self._current is None: + self._logger.error("Profile {} is invalid, cannot select, falling back to default".format(identifier)) + self._current = self.get_default() + return False + else: + return True def deselect(self): self._current = None @@ -310,6 +332,8 @@ class PrinterProfileManager(object): profile = self.get(default) if profile is not None: return profile + else: + self._logger.warn("Default profile {} is invalid, falling back to built-in defaults".format(default)) return copy.deepcopy(self.__class__.default) @@ -344,6 +368,7 @@ class PrinterProfileManager(object): try: profile = self._load_from_path(path) except InvalidProfileError: + self._logger.warn("Profile {} is invalid, skipping".format(identifier)) continue if profile is None: @@ -373,6 +398,9 @@ class PrinterProfileManager(object): with open(path) as f: profile = yaml.safe_load(f) + if profile is None or not isinstance(profile, dict): + raise InvalidProfileError("Profile is None or not a dictionary") + if self._migrate_profile(profile): try: self._save_to_path(path, profile, allow_overwrite=True) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 64a4c0b6..bf251bf6 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -490,11 +490,14 @@ class Server(object): # auto connect if self._settings.getBoolean(["serial", "autoconnect"]): - (port, baudrate) = self._settings.get(["serial", "port"]), self._settings.getInt(["serial", "baudrate"]) - printer_profile = printerProfileManager.get_default() - connectionOptions = printer.__class__.get_connection_options() - if port in connectionOptions["ports"]: - printer.connect(port=port, baudrate=baudrate, profile=printer_profile["id"] if "id" in printer_profile else "_default") + try: + (port, baudrate) = self._settings.get(["serial", "port"]), self._settings.getInt(["serial", "baudrate"]) + printer_profile = printerProfileManager.get_default() + connectionOptions = printer.__class__.get_connection_options() + if port in connectionOptions["ports"]: + printer.connect(port=port, baudrate=baudrate, profile=printer_profile["id"] if "id" in printer_profile else "_default") + except: + self._logger.exception("Something went wrong while attempting to automatically connect to the printer") # start up watchdogs if self._settings.getBoolean(["feature", "pollWatched"]):