diff --git a/octoprint_autobim/async_command.py b/octoprint_autobim/async_command.py index 1d6c65d..b20ddca 100644 --- a/octoprint_autobim/async_command.py +++ b/octoprint_autobim/async_command.py @@ -47,9 +47,9 @@ def _set_running(self): # Do not touch the rest of the implementation def handle(self, line): - if not self.__running: + if not self.__running or not line: return - self._handle_internal(line) + self._handle_internal(line.strip()) def _register_result(self, result): self.__running = False diff --git a/octoprint_autobim/g30.py b/octoprint_autobim/g30.py index 711b45a..a6ecb0b 100644 --- a/octoprint_autobim/g30.py +++ b/octoprint_autobim/g30.py @@ -4,7 +4,7 @@ from octoprint_autobim.utils import filter_commands -MARLIN_PATTERN = re.compile(r"^Bed X: -?\d+\.\d+ Y: -?\d+\.\d+ Z: (-?\d+\.\d+)$") +MARLIN_PATTERN = re.compile(r"^Bed X: ?-?\d+\.\d+ Y: ?-?\d+\.\d+ Z: ?(-?\d+\.\d+)$") KLIPPER_PATTERN = re.compile(r"^// Result is z=(-?\d+\.\d+)$") @@ -51,11 +51,11 @@ def _start(self, point): self._printer.commands(command) def _handle_internal(self, line): - if "Error:Probing Failed" == line.strip(): + if "Error:Probing Failed" == line: self._register_result(Result.error()) return - if self._ok_is_error and "ok" == line.strip(): + if self._ok_is_error and "ok" == line: self._register_result(Result.error()) return diff --git a/octoprint_autobim/templates/autobim_settings.jinja2 b/octoprint_autobim/templates/autobim_settings.jinja2 index 4d9f84f..6da9efe 100644 --- a/octoprint_autobim/templates/autobim_settings.jinja2 +++ b/octoprint_autobim/templates/autobim_settings.jinja2 @@ -142,7 +142,7 @@ G0 Z15
^// Result is z=(-?\d+\.\d+)$
^Bed X: -?\d+\.\d+ Y: -?\d+\.\d+ Z: (-?\d+\.\d+)$
^Bed X: ?-?\d+\.\d+ Y: ?-?\d+\.\d+ Z: ?(-?\d+\.\d+)$