Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-07-25 19:39:39 +0300
committerKevin O'Connor <kevin@koconnor.net>2022-07-29 18:40:54 +0300
commit2293e1506ffd54a5bb1e0bda90f1c497a7bdc20d (patch)
tree0359251d91dde73af7402d882195bc1ef67850d1
parentb725d971db3b4f722aa218b773005a0585910175 (diff)
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 <kevin@koconnor.net>
-rw-r--r--klippy/extras/canbus_ids.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/klippy/extras/canbus_ids.py b/klippy/extras/canbus_ids.py
index 5e70f8b9e..f96510fad 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):