force_move: Note force_enable() and restore_enable() are internal functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
be122411b5
commit
d1b41ea4a1
|
@ -56,7 +56,7 @@ class ForceMove:
|
||||||
if name not in self.steppers:
|
if name not in self.steppers:
|
||||||
raise self.printer.config_error("Unknown stepper %s" % (name,))
|
raise self.printer.config_error("Unknown stepper %s" % (name,))
|
||||||
return self.steppers[name]
|
return self.steppers[name]
|
||||||
def force_enable(self, stepper):
|
def _force_enable(self, stepper):
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
print_time = toolhead.get_last_move_time()
|
print_time = toolhead.get_last_move_time()
|
||||||
stepper_enable = self.printer.lookup_object('stepper_enable')
|
stepper_enable = self.printer.lookup_object('stepper_enable')
|
||||||
|
@ -66,7 +66,7 @@ class ForceMove:
|
||||||
enable.motor_enable(print_time)
|
enable.motor_enable(print_time)
|
||||||
toolhead.dwell(STALL_TIME)
|
toolhead.dwell(STALL_TIME)
|
||||||
return was_enable
|
return was_enable
|
||||||
def restore_enable(self, stepper, was_enable):
|
def _restore_enable(self, stepper, was_enable):
|
||||||
if not was_enable:
|
if not was_enable:
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
toolhead.dwell(STALL_TIME)
|
toolhead.dwell(STALL_TIME)
|
||||||
|
@ -101,7 +101,7 @@ class ForceMove:
|
||||||
def cmd_STEPPER_BUZZ(self, gcmd):
|
def cmd_STEPPER_BUZZ(self, gcmd):
|
||||||
stepper = self._lookup_stepper(gcmd)
|
stepper = self._lookup_stepper(gcmd)
|
||||||
logging.info("Stepper buzz %s", stepper.get_name())
|
logging.info("Stepper buzz %s", stepper.get_name())
|
||||||
was_enable = self.force_enable(stepper)
|
was_enable = self._force_enable(stepper)
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
dist, speed = BUZZ_DISTANCE, BUZZ_VELOCITY
|
dist, speed = BUZZ_DISTANCE, BUZZ_VELOCITY
|
||||||
if stepper.units_in_radians():
|
if stepper.units_in_radians():
|
||||||
|
@ -111,7 +111,7 @@ class ForceMove:
|
||||||
toolhead.dwell(.050)
|
toolhead.dwell(.050)
|
||||||
self.manual_move(stepper, -dist, speed)
|
self.manual_move(stepper, -dist, speed)
|
||||||
toolhead.dwell(.450)
|
toolhead.dwell(.450)
|
||||||
self.restore_enable(stepper, was_enable)
|
self._restore_enable(stepper, was_enable)
|
||||||
cmd_FORCE_MOVE_help = "Manually move a stepper; invalidates kinematics"
|
cmd_FORCE_MOVE_help = "Manually move a stepper; invalidates kinematics"
|
||||||
def cmd_FORCE_MOVE(self, gcmd):
|
def cmd_FORCE_MOVE(self, gcmd):
|
||||||
stepper = self._lookup_stepper(gcmd)
|
stepper = self._lookup_stepper(gcmd)
|
||||||
|
@ -120,7 +120,7 @@ class ForceMove:
|
||||||
accel = gcmd.get_float('ACCEL', 0., minval=0.)
|
accel = gcmd.get_float('ACCEL', 0., minval=0.)
|
||||||
logging.info("FORCE_MOVE %s distance=%.3f velocity=%.3f accel=%.3f",
|
logging.info("FORCE_MOVE %s distance=%.3f velocity=%.3f accel=%.3f",
|
||||||
stepper.get_name(), distance, speed, accel)
|
stepper.get_name(), distance, speed, accel)
|
||||||
self.force_enable(stepper)
|
self._force_enable(stepper)
|
||||||
self.manual_move(stepper, distance, speed, accel)
|
self.manual_move(stepper, distance, speed, accel)
|
||||||
cmd_SET_KINEMATIC_POSITION_help = "Force a low-level kinematic position"
|
cmd_SET_KINEMATIC_POSITION_help = "Force a low-level kinematic position"
|
||||||
def cmd_SET_KINEMATIC_POSITION(self, gcmd):
|
def cmd_SET_KINEMATIC_POSITION(self, gcmd):
|
||||||
|
|
Loading…
Reference in New Issue