diff --git a/examples/try-all-zones.py b/examples/try-all-zones.py new file mode 100644 index 0000000..bae3d54 --- /dev/null +++ b/examples/try-all-zones.py @@ -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) diff --git a/openrgb/binreader.py b/openrgb/binreader.py index c879eea..30b2a2f 100644 --- a/openrgb/binreader.py +++ b/openrgb/binreader.py @@ -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