bed_level: fix compatibility with python 3.7
This commit is contained in:
parent
55af0d753c
commit
a5b639fba2
@ -23,9 +23,9 @@ def find_closest(screws, point, max_distance, remove=False):
|
|||||||
if len(screws) == 0:
|
if len(screws) == 0:
|
||||||
return None
|
return None
|
||||||
closest = screws[0]
|
closest = screws[0]
|
||||||
min_distance = math.dist(closest, point)
|
min_distance = math.hypot(closest[0] - point[0], closest[1] - point[1])
|
||||||
for screw in screws[1:]:
|
for screw in screws[1:]:
|
||||||
distance = math.dist(screw, point)
|
distance = math.hypot(screw[0] - point[0], screw[1] - point[1])
|
||||||
if distance < min_distance:
|
if distance < min_distance:
|
||||||
closest = screw
|
closest = screw
|
||||||
min_distance = distance
|
min_distance = distance
|
||||||
@ -98,7 +98,7 @@ class BedLevelPanel(ScreenPanel):
|
|||||||
min_y = min(y_positions)
|
min_y = min(y_positions)
|
||||||
max_y = max(y_positions)
|
max_y = max(y_positions)
|
||||||
max_distance = math.ceil(
|
max_distance = math.ceil(
|
||||||
math.dist((min_x, min_y), (max_x, max_y))
|
math.hypot(max_x - min_x, max_y - min_y)
|
||||||
/ min(self.x_cnt, self.y_cnt, 3)
|
/ min(self.x_cnt, self.y_cnt, 3)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user