fix
This commit is contained in:
16
idm.py
16
idm.py
@@ -598,9 +598,9 @@ class IDMProbe:
|
|||||||
def _get_trapq_position(self, print_time):
|
def _get_trapq_position(self, print_time):
|
||||||
move = None
|
move = None
|
||||||
if self._last_trapq_move:
|
if self._last_trapq_move:
|
||||||
last = self._last_trapq_move
|
last = self._last_trapq_move[0]
|
||||||
last_end = last.print_time + last.move_t
|
last_end = last.print_time + last.move_t
|
||||||
if last.print_time <= print_time <= last_end:
|
if last.print_time <= print_time < last_end:
|
||||||
move = last
|
move = last
|
||||||
if move is None:
|
if move is None:
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
@@ -608,8 +608,8 @@ class IDMProbe:
|
|||||||
count = ffi_lib.trapq_extract_old(self.trapq, data, 1, 0.0, print_time)
|
count = ffi_lib.trapq_extract_old(self.trapq, data, 1, 0.0, print_time)
|
||||||
if not count:
|
if not count:
|
||||||
return None, None
|
return None, None
|
||||||
|
self._last_trapq_move = data
|
||||||
move = data[0]
|
move = data[0]
|
||||||
self._last_trapq_move = move
|
|
||||||
move_time = max(0.0, min(move.move_t, print_time - move.print_time))
|
move_time = max(0.0, min(move.move_t, print_time - move.print_time))
|
||||||
dist = (move.start_v + .5 * move.accel * move_time) * move_time
|
dist = (move.start_v + .5 * move.accel * move_time) * move_time
|
||||||
pos = (move.start_x + move.x_r * dist, move.start_y + move.y_r * dist,
|
pos = (move.start_x + move.x_r * dist, move.start_y + move.y_r * dist,
|
||||||
@@ -1585,9 +1585,9 @@ class IDMMeshHelper:
|
|||||||
return points
|
return points
|
||||||
|
|
||||||
def calibrate(self, gcmd):
|
def calibrate(self, gcmd):
|
||||||
self.min_x, self.min_y = coord_fallback(gcmd, "MESH_MIN", float,
|
self.min_x, self.min_y = coord_fallback(gcmd, "MESH_MIN", convert_float,
|
||||||
self.def_min_x, self.def_min_y, lambda v, d: max(v, d))
|
self.def_min_x, self.def_min_y, lambda v, d: max(v, d))
|
||||||
self.max_x, self.max_y = coord_fallback(gcmd, "MESH_MAX", float,
|
self.max_x, self.max_y = coord_fallback(gcmd, "MESH_MAX", convert_float,
|
||||||
self.def_max_x, self.def_max_y, lambda v, d: min(v, d))
|
self.def_max_x, self.def_max_y, lambda v, d: min(v, d))
|
||||||
self.res_x, self.res_y = coord_fallback(gcmd, "PROBE_COUNT", int,
|
self.res_x, self.res_y = coord_fallback(gcmd, "PROBE_COUNT", int,
|
||||||
self.def_res_x, self.def_res_y, lambda v, _d: max(v, 3))
|
self.def_res_x, self.def_res_y, lambda v, _d: max(v, 3))
|
||||||
@@ -1987,6 +1987,12 @@ def arc_points(cx, cy, r, start_angle, span):
|
|||||||
|
|
||||||
return points
|
return points
|
||||||
|
|
||||||
|
def convert_float(data):
|
||||||
|
toFloat=float(data)
|
||||||
|
if np.isinf(toFloat) or np.isnan(toFloat):
|
||||||
|
raise ValueError(f"Convert error when trying to convert string \"{data}\" into float")
|
||||||
|
return toFloat
|
||||||
|
|
||||||
def coord_fallback(gcmd, name, parse, def_x, def_y, map=lambda v, d: v):
|
def coord_fallback(gcmd, name, parse, def_x, def_y, map=lambda v, d: v):
|
||||||
param = gcmd.get(name, None)
|
param = gcmd.get(name, None)
|
||||||
if param is not None:
|
if param is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user