Skip to content

Commit

Permalink
bugfix/z_tilt: check if retry_result is a number before converting
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerlz committed Aug 12, 2024
1 parent 354c759 commit 8bff020
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion klippy/extras/z_tilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def __init__(self, printer):
)

def check_retry_result(self, retry_result):
if (retry_result and retry_result.isdigit() and int(retry_result) == 0) or retry_result == "done":
if retry_result and (
(isinstance(retry_result, str) and retry_result == "done")
or (isinstance(retry_result, float) and int(retry_result) == 0)
):
self.applied = True
return retry_result

Expand Down
5 changes: 4 additions & 1 deletion klippy/extras/z_tilt_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def __init__(self, printer):
)

def check_retry_result(self, retry_result):
if (retry_result and retry_result.isdigit() and int(retry_result) == 0) or retry_result == "done":
if retry_result and (
(isinstance(retry_result, str) and retry_result == "done")
or (isinstance(retry_result, float) and int(retry_result) == 0)
):
self.applied = True
return retry_result

Expand Down

0 comments on commit 8bff020

Please sign in to comment.