diff --git a/pyartnet/__version__.py b/pyartnet/__version__.py index 32a90a3..ef72cc0 100644 --- a/pyartnet/__version__.py +++ b/pyartnet/__version__.py @@ -1 +1 @@ -__version__ = '0.8.0' +__version__ = '0.8.1' diff --git a/pyartnet/dmx_channel.py b/pyartnet/dmx_channel.py index 372be0a..32c75ee 100644 --- a/pyartnet/dmx_channel.py +++ b/pyartnet/dmx_channel.py @@ -88,7 +88,7 @@ def add_fade(self, fade_list: typing.List[int], duration_ms: int, fade_class=pya assert isinstance(k, pyartnet.fades.FadeBase), type(k) assert isinstance(k.val_target, int) - assert 0 <= k.val_target <= 255 ** self._CHANNEL_SIZE + assert 0 <= k.val_target <= (256 ** self._CHANNEL_SIZE) - 1 # calculate how much steps we will be having step_time_ms = self.__universe._artnet_node.sleep_time * 1000 diff --git a/readme.md b/readme.md index e264eae..3995297 100644 --- a/readme.md +++ b/readme.md @@ -108,11 +108,13 @@ channel.add_fade([0xFFFF,0,0], 5000) # Changelog +#### 0.8.1 (26.02.2021) +- Fixed an issue with the max value for channels with 16bits and more + #### 0.8.0 (11.02.2021) - Added support for channels with 16, 24 and 32bits - #### 0.7.0 (28.10.2020) - renamed logger to ``pyartnet`` to make it consistent with the module name - callbacks on the channel now get the channel passed in as an argument diff --git a/tests/test_channel.py b/tests/test_channel.py index f2f97c9..934c6f5 100644 --- a/tests/test_channel.py +++ b/tests/test_channel.py @@ -152,3 +152,13 @@ def test_channel_boundaries(): pyartnet.DmxChannel16Bit(univ, 512, 1) assert str(r.value) == 'End position of channel out of universe (1..512): start: 512 width: 1 * 2bytes -> 513' pyartnet.DmxChannel16Bit(univ, 511, 1) + + +def test_channel_max_values(): + node = pyartnet.ArtNetNode(host='') + univ = pyartnet.DmxUniverse(node) + + univ.add_channel(10, 1, channel_type=pyartnet.DmxChannel).add_fade([0xFF], 0) + univ.add_channel(20, 1, channel_type=pyartnet.DmxChannel16Bit).add_fade([0xFFFF], 0) + univ.add_channel(30, 1, channel_type=pyartnet.DmxChannel24Bit).add_fade([0xFFFFFF], 0) + univ.add_channel(40, 1, channel_type=pyartnet.DmxChannel32Bit).add_fade([0xFFFFFFFF], 0)