From 2293e1506ffd54a5bb1e0bda90f1c497a7bdc20d Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 25 Jul 2022 12:39:39 -0400 Subject: [PATCH] canbus_ids: Use 4 as the first nodeid to reduce id bitstuffing Starting with nodeid 4 instead of nodeid 0 can reduce bitstuffing of the id field in common configurations. Signed-off-by: Kevin O'Connor --- klippy/extras/canbus_ids.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klippy/extras/canbus_ids.py b/klippy/extras/canbus_ids.py index 5e70f8b9..f96510fa 100644 --- a/klippy/extras/canbus_ids.py +++ b/klippy/extras/canbus_ids.py @@ -4,6 +4,8 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. +NODEID_FIRST = 4 + class PrinterCANBus: def __init__(self, config): self.printer = config.get_printer() @@ -11,7 +13,7 @@ class PrinterCANBus: 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) + new_id = len(self.ids) + NODEID_FIRST self.ids[canbus_uuid] = new_id return new_id def get_nodeid(self, canbus_uuid):