cartesian: Make it clear which methods of CartKinematics are internal

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-12-08 18:14:46 -05:00
parent 0718a1bd1f
commit 35428f2e04
1 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ class CartKinematics:
for i in StepList: for i in StepList:
s = self.steppers[i] s = self.steppers[i]
s.mcu_stepper.set_position(int(newpos[i]*s.inv_step_dist + 0.5)) s.mcu_stepper.set_position(int(newpos[i]*s.inv_step_dist + 0.5))
def get_homed_position(self, homing_state): def _get_homed_position(self, homing_state):
pos = [None]*3 pos = [None]*3
for axis in homing_state.get_axes(): for axis in homing_state.get_axes():
s = self.steppers[axis] s = self.steppers[axis]
@ -63,13 +63,13 @@ class CartKinematics:
coord[axis] = r2pos coord[axis] = r2pos
homing_state.plan_second_home( homing_state.plan_second_home(
list(coord), homepos, [s], s.homing_speed/2.0) list(coord), homepos, [s], s.homing_speed/2.0)
homing_state.plan_calc_position(self.get_homed_position) homing_state.plan_calc_position(self._get_homed_position)
def motor_off(self, move_time): def motor_off(self, move_time):
self.limits = [(1.0, -1.0)] * 3 self.limits = [(1.0, -1.0)] * 3
for stepper in self.steppers: for stepper in self.steppers:
stepper.motor_enable(move_time, 0) stepper.motor_enable(move_time, 0)
self.need_motor_enable = True self.need_motor_enable = True
def check_motor_enable(self, move_time, move): def _check_motor_enable(self, move_time, move):
need_motor_enable = False need_motor_enable = False
for i in StepList: for i in StepList:
if move.axes_d[i]: if move.axes_d[i]:
@ -78,7 +78,7 @@ class CartKinematics:
self.need_motor_enable = need_motor_enable self.need_motor_enable = need_motor_enable
def query_endstops(self, query_state): def query_endstops(self, query_state):
query_state.set_steppers(self.steppers) query_state.set_steppers(self.steppers)
def check_endstops(self, move): def _check_endstops(self, move):
end_pos = move.end_pos end_pos = move.end_pos
for i in StepList: for i in StepList:
if (move.axes_d[i] if (move.axes_d[i]
@ -93,18 +93,18 @@ class CartKinematics:
xpos, ypos = move.end_pos[:2] xpos, ypos = move.end_pos[:2]
if (xpos < limits[0][0] or xpos > limits[0][1] if (xpos < limits[0][0] or xpos > limits[0][1]
or ypos < limits[1][0] or ypos > limits[1][1]): or ypos < limits[1][0] or ypos > limits[1][1]):
self.check_endstops(move) self._check_endstops(move)
if not move.axes_d[2]: if not move.axes_d[2]:
# Normal XY move - use defaults # Normal XY move - use defaults
return return
# Move with Z - update velocity and accel for slower Z axis # Move with Z - update velocity and accel for slower Z axis
self.check_endstops(move) self._check_endstops(move)
z_ratio = move.move_d / abs(move.axes_d[2]) z_ratio = move.move_d / abs(move.axes_d[2])
move.limit_speed( move.limit_speed(
self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio)
def move(self, move_time, move): def move(self, move_time, move):
if self.need_motor_enable: if self.need_motor_enable:
self.check_motor_enable(move_time, move) self._check_motor_enable(move_time, move)
inv_accel = 1. / move.accel inv_accel = 1. / move.accel
inv_cruise_v = 1. / move.cruise_v inv_cruise_v = 1. / move.cruise_v
for i in StepList: for i in StepList: