Skip to content

Commit

Permalink
Resolving #8 by making sure the packer can handle lists
Browse files Browse the repository at this point in the history
  • Loading branch information
bahorn committed Jul 9, 2020
1 parent 2cc8b33 commit 445fdd4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
21 changes: 21 additions & 0 deletions examples/try-all-zones.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import time
import sys,os

sys.path.append(os.path.realpath('.'))
from openrgb import OpenRGB


seq = [
(214, 2, 112),
(0, 56, 168),
(155, 79, 150),
(0, 56, 168),
(214, 2, 112)
]

client = OpenRGB('localhost', 6742)

for device in client.devices():
for mode in device.modes:
mode.active()
time.sleep(0.1)
7 changes: 6 additions & 1 deletion openrgb/binreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ def _unpack(self, fmt):
return res

def _pack(self, fmt, data):
res = struct.pack(fmt, data)

if type(data) in (tuple, list):
res = struct.pack(fmt, *data)
else:
res = struct.pack(fmt, data)

self.data += res
return res

Expand Down

0 comments on commit 445fdd4

Please sign in to comment.