diff --git a/cnc/coordinates.py b/cnc/coordinates.py index 3cc18a3..e2260fd 100644 --- a/cnc/coordinates.py +++ b/cnc/coordinates.py @@ -55,10 +55,10 @@ class Coordinates(object): :param base_e: Base for e axis. :return: New rounded object. """ - return Coordinates(round(self.x / base_x) * base_x, - round(self.y / base_y) * base_y, - round(self.z / base_z) * base_z, - round(self.e / base_e) * base_e) + return Coordinates(round(self.x / base_x, 2) * base_x, + round(self.y / base_y, 2) * base_y, + round(self.z / base_z, 2) * base_z, + round(self.e / base_e, 2) * base_e) def find_max(self): """ Find a maximum value of all values. diff --git a/cnc/gmachine.py b/cnc/gmachine.py index 4cac521..b5dd99c 100644 --- a/cnc/gmachine.py +++ b/cnc/gmachine.py @@ -103,7 +103,7 @@ class GMachine(object): def __check_delta(self, delta): pos = self._position + delta - logging.debug("_check_delta : pos init = {} - delta = {} - pos = {}".format(self._position, delta, pos)) + logging.debug("_check_delta : pos init : {}, delta : {}, result : {}".format(self._position, delta, pos)) if not pos.is_in_aabb(Coordinates(0.0, 0.0, 0.0, 0.0), Coordinates(TABLE_SIZE_X_MM, TABLE_SIZE_Y_MM, TABLE_SIZE_Z_MM, 0)): @@ -119,10 +119,10 @@ class GMachine(object): def _move_linear(self, delta, velocity, safe_zero=False): if not safe_zero: - delta = delta.round(round(1.0 / STEPPER_PULSES_PER_MM_X, 2), - round(1.0 / STEPPER_PULSES_PER_MM_Y, 2), - round(1.0 / STEPPER_PULSES_PER_MM_Z, 2), - round(1.0 / STEPPER_PULSES_PER_MM_E, 2)) + delta = delta.round(1.0 / STEPPER_PULSES_PER_MM_X, + 1.0 / STEPPER_PULSES_PER_MM_Y, + 1.0 / STEPPER_PULSES_PER_MM_Z, + 1.0 / STEPPER_PULSES_PER_MM_E) if delta.is_zero(): return self.__check_delta(delta)