Explicitly convert byte arrays into bytes
This commit is contained in:
parent
5edbc8c9e4
commit
e6f48a4bc1
1 changed files with 6 additions and 6 deletions
12
c4ctrl.py
12
c4ctrl.py
|
@ -350,7 +350,7 @@ class Kitchenlight: # {{{1
|
|||
v[14:16] = int(cb.color[0:2], base=16).to_bytes(2, self._END)
|
||||
v[16:18] = int(cb.color[2:4], base=16).to_bytes(2, self._END)
|
||||
v[18:20] = int(cb.color[4:6], base=16).to_bytes(2, self._END)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
|
||||
def matrix(self, lines=8):
|
||||
""" Set to mode "matrix".
|
||||
|
@ -362,7 +362,7 @@ class Kitchenlight: # {{{1
|
|||
v = memoryview(d)
|
||||
v[0:4] = int(2).to_bytes(4, self._END) # Screen 2
|
||||
v[4:8] = int(lines).to_bytes(4, self._END)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
|
||||
def moodlight(self, mode=1):
|
||||
""" Set to mode "moodlight".
|
||||
|
@ -397,7 +397,7 @@ class Kitchenlight: # {{{1
|
|||
v[9:13] = int(10).to_bytes(4, self._END)
|
||||
# Pause
|
||||
v[13:17] = int(10000).to_bytes(4, self._END)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
|
||||
def openchaos(self, delay=1000):
|
||||
""" Set to mode "openchaos".
|
||||
|
@ -408,7 +408,7 @@ class Kitchenlight: # {{{1
|
|||
v = memoryview(d)
|
||||
v[0:4] = int(4).to_bytes(4, self._END) # Screen 4
|
||||
v[4:8] = int(delay).to_bytes(4, self._END)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
|
||||
def pacman(self):
|
||||
""" Set to mode "pacman". """
|
||||
|
@ -441,7 +441,7 @@ class Kitchenlight: # {{{1
|
|||
v[4:8] = int(delay).to_bytes(4, self._END)
|
||||
v[8:8 + len(text)] = text
|
||||
v[len(d) - 1:len(d)] = bytes(1)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
|
||||
def flood(self):
|
||||
""" Set to mode "flood". """
|
||||
|
@ -464,7 +464,7 @@ class Kitchenlight: # {{{1
|
|||
v[4:8] = int(generations).to_bytes(4, self._END)
|
||||
v[8:12] = int(lifetime).to_bytes(4, self._END)
|
||||
v[12:16] = int(rainbow).to_bytes(4, self._END)
|
||||
self._switch(d)
|
||||
self._switch(bytes(d))
|
||||
# }}}1
|
||||
|
||||
class Dmx: # {{{1
|
||||
|
|
Loading…
Reference in a new issue