aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/canbus_ids.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/canbus_ids.py')
-rw-r--r--klippy/extras/canbus_ids.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/klippy/extras/canbus_ids.py b/klippy/extras/canbus_ids.py
index f96510fa..f0c96016 100644
--- a/klippy/extras/canbus_ids.py
+++ b/klippy/extras/canbus_ids.py
@@ -6,21 +6,24 @@
NODEID_FIRST = 4
+
class PrinterCANBus:
def __init__(self, config):
self.printer = config.get_printer()
self.ids = {}
+
def add_uuid(self, config, canbus_uuid, canbus_iface):
if canbus_uuid in self.ids:
raise config.error("Duplicate canbus_uuid")
new_id = len(self.ids) + NODEID_FIRST
self.ids[canbus_uuid] = new_id
return new_id
+
def get_nodeid(self, canbus_uuid):
if canbus_uuid not in self.ids:
- raise self.printer.config_error("Unknown canbus_uuid %s"
- % (canbus_uuid,))
+ raise self.printer.config_error("Unknown canbus_uuid %s" % (canbus_uuid,))
return self.ids[canbus_uuid]
+
def load_config(config):
return PrinterCANBus(config)