diff --git a/.versioneer-lookup b/.versioneer-lookup index 3e739db5c..d67bed321 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -24,10 +24,10 @@ maintenance 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev fix/.* 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev improve/.* 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.4.1rc4 +# staging/maintenance is currently the branch for preparation of 1.4.1rc5 # so is regressionfix/... -staging/maintenance 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev -regressionfix/.* 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev +staging/maintenance 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev +regressionfix/.* 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev diff --git a/SUPPORTERS.md b/SUPPORTERS.md index 8876adb44..d7304f123 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -17,7 +17,6 @@ thanks to everyone who contributed! * D Brian Kimmel * DeltaMaker 3D Printers * Dennis Breining - * Dorian Gray * Eric Betts * Ernesto Martinez * Franziska Kunsmann @@ -66,4 +65,4 @@ thanks to everyone who contributed! * Sven Mueller * Ulrich Kempken -and 1886 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! \ No newline at end of file +and 1932 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! \ No newline at end of file diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 291d3b9fd..23e61d123 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -13,8 +13,8 @@ from octoprint.util.version import get_octoprint_version_string, is_released_oct from flask import jsonify from flask_babel import gettext -SENTRY_URL_SERVER = "https://829e2245ec4d4693a0b708523004c4eb@o118517.ingest.sentry.io/1373987" -SENTRY_URL_COREUI = "https://fcbbcf95f5514b59866c5e7360fba1fe@o118517.ingest.sentry.io/1374096" +SENTRY_URL_SERVER = "https://912dd511a2274c6f99705d926c2b5126@o118517.ingest.sentry.io/1373987" +SENTRY_URL_COREUI = "https://572ed52f42d241c484db1c741e3c131e@o118517.ingest.sentry.io/1374096" SETTINGS_DEFAULTS = dict(enabled=False, enabled_unreleased=False, diff --git a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 index a774980da..39457dacf 100644 --- a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 +++ b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 @@ -268,7 +268,7 @@ - () + () diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 5c312ffff..6aab74705 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -267,6 +267,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): logging.getLogger("SERIAL").info("serial.log is currently not enabled, you can enable it via Settings > Serial Connection > Log communication to serial.log") self._comm = comm.MachineCom(port, baudrate, callbackObject=self, printerProfileManager=self._printerProfileManager) + self._comm.start() def disconnect(self, *args, **kwargs): """ diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 761419766..073c26793 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -63,7 +63,12 @@ def _create_lastmodified(path, recursive): return max(lms) else: - storage, path_in_storage = path.split("/", 1) + if "/" in path: + storage, path_in_storage = path.split("/", 1) + else: + storage = path + path_in_storage = None + try: return fileManager.last_modified(storage, path=path_in_storage, recursive=recursive) except Exception: diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index 7c40aa8ee..3848d8298 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -242,6 +242,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, delta = self._last_current + self._base_rate_limit * self._throttle_factor - now if delta > 0: self._held_back_current = threading.Timer(delta, lambda: self.on_printer_send_current_data(data)) + self._held_back_current.start() return self._last_current = now diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 831fade1a..d34c98722 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -650,12 +650,17 @@ class MachineCom(object): self._monitoring_active = True self.monitoring_thread = threading.Thread(target=self._monitor, name="comm._monitor") self.monitoring_thread.daemon = True - self.monitoring_thread.start() # sending thread self._send_queue_active = True self.sending_thread = threading.Thread(target=self._send_loop, name="comm.sending_thread") self.sending_thread.daemon = True + + def start(self): + # doing this here instead of __init__ combats a race condition where + # self._comm in the printer interface is still None on first pushs from + # the comm layer during detection + self.monitoring_thread.start() self.sending_thread.start() def __del__(self): @@ -993,15 +998,17 @@ class MachineCom(object): self._logger.exception("Error while trying to close serial port") is_error = True - # if we are printing, this will also make sure of firing PRINT_FAILED - if is_error: - self._changeState(self.STATE_CLOSED_WITH_ERROR) - else: - self._changeState(self.STATE_CLOSED) else: deactivate_monitoring_and_send_queue() + self._serial = None + # if we are printing, this will also make sure of firing PRINT_FAILED + if is_error: + self._changeState(self.STATE_CLOSED_WITH_ERROR) + else: + self._changeState(self.STATE_CLOSED) + if settings().getBoolean(["feature", "sdSupport"]): self._sdFileList = [] @@ -1682,6 +1689,10 @@ class MachineCom(object): self._changeState(self.STATE_DETECT_SERIAL) self._perform_detection_step(init=True) + if not self._state in (self.STATE_CONNECTING, self.STATE_DETECT_SERIAL): + # we got cancelled during connection, bail + return + # Start monitoring the serial port self._log("Connected to: %s, starting monitor" % self._serial) @@ -2438,19 +2449,30 @@ class MachineCom(object): self._detection_candidates)))) def attempt_handshake(): - timeout = self._get_communication_timeout_interval() - if self._serial.timeout != timeout: - self._serial.timeout = timeout - self._timeout = self._ok_timeout = monotonic_time() + timeout - - log("Handshake attempt #{} with timeout {}s".format(self._detection_retry + 1, timeout)) - self._detection_retry += 1 - self._do_send_without_checksum(b"", log=False) # new line to reset things - self.sayHello(tags={"trigger:detection", }) + timeout = self._get_communication_timeout_interval() + + log("Handshake attempt #{} with timeout {}s".format(self._detection_retry, timeout)) + try: + if self._serial.timeout != timeout: + self._serial.timeout = timeout + self._timeout = self._ok_timeout = monotonic_time() + timeout + except Exception: + self._log("Unexpected error while setting timeout {}: {}".format(timeout, get_exception_string())) + self._logger.exception("Unexpected error while setting timeout {}".format(timeout)) + else: + self._do_send_without_checksum(b"", log=False) # new line to reset things + self.sayHello(tags={"trigger:detection", }) while len(self._detection_candidates) > 0 or self._detection_retry < self.DETECTION_RETRIES: + if self._state not in (self.STATE_DETECT_SERIAL,): + return + if self._detection_retry < self.DETECTION_RETRIES: + if self._serial is None: + self._detection_retry = self.DETECTION_RETRIES + continue + attempt_handshake() return