From: Joseph Coffland Date: Tue, 18 Dec 2018 00:17:21 +0000 (-0800) Subject: Fixed pause fail in long run due to planner ID wrap around X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=eabf290e7cf792c5cbbed2e454f6b5a4772135f9;p=bbctrl-firmware Fixed pause fail in long run due to planner ID wrap around --- diff --git a/src/py/bbctrl/CommandQueue.py b/src/py/bbctrl/CommandQueue.py index 25bc6b7..ee20ee8 100644 --- a/src/py/bbctrl/CommandQueue.py +++ b/src/py/bbctrl/CommandQueue.py @@ -33,7 +33,7 @@ log.setLevel(logging.WARNING) # 16-bit less with wrap around -def id_less(a, b): return (1 << 15) < (a - b) % ((1 << 16) - 1) +def id_less(a, b): return (1 << 15) < (a - b) & ((1 << 16) - 1) class CommandQueue(): diff --git a/src/py/bbctrl/Planner.py b/src/py/bbctrl/Planner.py index 43407f4..fc6e7e9 100644 --- a/src/py/bbctrl/Planner.py +++ b/src/py/bbctrl/Planner.py @@ -270,10 +270,6 @@ class Planner(): def _encode(self, block): - # Handle id wrapping by restricting ids to 16-bit - # See CommandQueue id_less() - block['id'] %= (1 << 16) - 1 - cmd = self.__encode(block) if cmd is not None: