From 4cbcd45ce908e72a04bead980bd631b932e6ef03 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 13 Mar 2021 15:02:41 -0500 Subject: [PATCH] serialhdl: Only load the CAN module if CAN bus is configured Temporarily postpone loading the CAN module so that moonraker (and similar) can improve upgrade scripts. Signed-off-by: Kevin O'Connor --- klippy/serialhdl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index 19b67088..9294b120 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -4,7 +4,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. import logging, threading, os -import serial, can +import serial import msgproto, chelper, util @@ -103,6 +103,7 @@ class SerialReader: self.serialqueue, receive_window) return True def connect_canbus(self, canbus_uuid, canbus_nodeid, canbus_iface="can0"): + import can # XXX txid = canbus_nodeid * 2 + 256 filters = [{"can_id": txid+1, "can_mask": 0x7ff, "extended": False}] # Prep for SET_NODEID command