aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-08-14 11:46:35 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-20 12:45:00 -0400
commit3ccecc568dbfd505fe3bdc46b4d16bf7a4528996 (patch)
tree136120849523ef2e0fc5c98ed632d4e03cdf31e9 /klippy/toolhead.py
parentcee200e509f5cbd948617f287646f23f5f761fd7 (diff)
downloadkutter-3ccecc568dbfd505fe3bdc46b4d16bf7a4528996.tar.gz
kutter-3ccecc568dbfd505fe3bdc46b4d16bf7a4528996.tar.xz
kutter-3ccecc568dbfd505fe3bdc46b4d16bf7a4528996.zip
mcu: Initial support for multiple micro-controllers
Add initial support for controlling multiple independent micro-controllers from a single Klippy host instance. Add basic support for synchronizing the clocks of the additional mcus to the main mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index fadbbae6..7a1b3e52 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import homing, cartesian, corexy, delta, extruder
+import mcu, homing, cartesian, corexy, delta, 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
@@ -184,7 +184,8 @@ class ToolHead:
def __init__(self, printer, config):
self.printer = printer
self.reactor = printer.reactor
- self.mcu = printer.objects['mcu']
+ self.all_mcus = mcu.get_printer_mcus(printer)
+ self.mcu = self.all_mcus[0]
self.max_velocity = config.getfloat('max_velocity', above=0.)
self.max_accel = config.getfloat('max_accel', above=0.)
self.max_accel_to_decel = config.getfloat(
@@ -227,7 +228,8 @@ class ToolHead:
def update_move_time(self, movetime):
self.print_time += movetime
flush_to_time = self.print_time - self.move_flush_time
- self.mcu.flush_moves(flush_to_time)
+ for m in self.all_mcus:
+ m.flush_moves(flush_to_time)
def get_next_move_time(self):
if not self.sync_print_time:
return self.print_time
@@ -248,9 +250,10 @@ class ToolHead:
if sync_print_time or must_sync:
self.sync_print_time = True
self.move_queue.set_flush_time(self.buffer_time_high)
- self.mcu.flush_moves(self.print_time)
self.need_check_stall = -1.
self.reactor.update_timer(self.flush_timer, self.reactor.NEVER)
+ for m in self.all_mcus:
+ m.flush_moves(self.print_time)
def get_last_move_time(self):
self._flush_lookahead()
return self.get_next_move_time()
@@ -357,7 +360,8 @@ class ToolHead:
self.commanded_pos[3] = extrude_pos
# Misc commands
def check_active(self, eventtime):
- self.mcu.check_active(self.print_time, eventtime)
+ for m in self.all_mcus:
+ m.check_active(self.print_time, eventtime)
if not self.sync_print_time:
return True
return self.print_time + 60. > self.mcu.estimated_print_time(eventtime)
@@ -368,7 +372,8 @@ class ToolHead:
self.print_time, buffer_time, self.print_stall)
def force_shutdown(self):
try:
- self.mcu.force_shutdown()
+ for m in self.all_mcus:
+ m.force_shutdown()
self.move_queue.reset()
self.reset_print_time()
except: