Skip to content

Commit

Permalink
0.8.1:
Browse files Browse the repository at this point in the history
- Fixed an issue with the max value for channels with 16bits and more (closes #8)
  • Loading branch information
spacemanspiff2007 committed Feb 26, 2021
1 parent d01fb0f commit bb03bea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyartnet/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.8.0'
__version__ = '0.8.1'
2 changes: 1 addition & 1 deletion pyartnet/dmx_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit bb03bea

Please sign in to comment.