Skip to content

Commit 445fdd4

Browse files
committed
Resolving #8 by making sure the packer can handle lists
1 parent 2cc8b33 commit 445fdd4

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

examples/try-all-zones.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import time
2+
import sys,os
3+
4+
sys.path.append(os.path.realpath('.'))
5+
from openrgb import OpenRGB
6+
7+
8+
seq = [
9+
(214, 2, 112),
10+
(0, 56, 168),
11+
(155, 79, 150),
12+
(0, 56, 168),
13+
(214, 2, 112)
14+
]
15+
16+
client = OpenRGB('localhost', 6742)
17+
18+
for device in client.devices():
19+
for mode in device.modes:
20+
mode.active()
21+
time.sleep(0.1)

openrgb/binreader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ def _unpack(self, fmt):
1414
return res
1515

1616
def _pack(self, fmt, data):
17-
res = struct.pack(fmt, data)
17+
18+
if type(data) in (tuple, list):
19+
res = struct.pack(fmt, *data)
20+
else:
21+
res = struct.pack(fmt, data)
22+
1823
self.data += res
1924
return res
2025

0 commit comments

Comments
 (0)