mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-08 23:46:25 -06:00
toolhead: Move kinematic modules to new kinematics/ directory
Move extruder.py, cartesian.py, corexy.py, and delta.py to a new kinematics/ sub-directory. This is intended to make adding new kinematics a little easier. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7d897d84d7
commit
8faab46ed2
9 changed files with 37 additions and 17 deletions
|
@ -3,8 +3,8 @@
|
|||
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import math, logging
|
||||
import mcu, homing, cartesian, corexy, delta, extruder
|
||||
import math, logging, importlib
|
||||
import mcu, homing, kinematics.extruder
|
||||
|
||||
# Common suffixes: _d is distance (in mm), _v is velocity (in
|
||||
# mm/second), _v2 is velocity squared (mm^2/s^2), _t is time (in
|
||||
|
@ -227,12 +227,16 @@ class ToolHead:
|
|||
self.motor_off_timer = self.reactor.register_timer(
|
||||
self._motor_off_handler, self.reactor.NOW)
|
||||
# Create kinematics class
|
||||
self.extruder = extruder.DummyExtruder()
|
||||
self.extruder = kinematics.extruder.DummyExtruder()
|
||||
self.move_queue.set_extruder(self.extruder)
|
||||
kintypes = {'cartesian': cartesian.CartKinematics,
|
||||
'corexy': corexy.CoreXYKinematics,
|
||||
'delta': delta.DeltaKinematics}
|
||||
self.kin = config.getchoice('kinematics', kintypes)(self, config)
|
||||
kin_name = config.get('kinematics')
|
||||
try:
|
||||
mod = importlib.import_module('kinematics.' + kin_name)
|
||||
self.kin = mod.load_kinematics(self, config)
|
||||
except:
|
||||
msg = "Error loading kinematics '%s'" % (kin_name,)
|
||||
logging.exception(msg)
|
||||
raise config.error(msg)
|
||||
# SET_VELOCITY_LIMIT command
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
gcode.register_command('SET_VELOCITY_LIMIT', self.cmd_SET_VELOCITY_LIMIT,
|
||||
|
@ -353,7 +357,7 @@ class ToolHead:
|
|||
self.dwell(STALL_TIME)
|
||||
last_move_time = self.get_last_move_time()
|
||||
self.kin.motor_off(last_move_time)
|
||||
for ext in extruder.get_printer_extruders(self.printer):
|
||||
for ext in kinematics.extruder.get_printer_extruders(self.printer):
|
||||
ext.motor_off(last_move_time)
|
||||
self.dwell(STALL_TIME)
|
||||
self.need_motor_off = False
|
||||
|
@ -444,3 +448,4 @@ class ToolHead:
|
|||
|
||||
def add_printer_objects(config):
|
||||
config.get_printer().add_object('toolhead', ToolHead(config))
|
||||
kinematics.extruder.add_printer_objects(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue