Skip to content

Commit

Permalink
Fixed LED-ring memory compatibility with Python 3 (bitcraze#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
evoggy committed Sep 7, 2015
1 parent 78d2dc5 commit 26257e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cflib/crazyflie/mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def new_data(self, mem, addr, data):
def write_data(self, write_finished_cb):
"""Write the saved LED-ring data to the Crazyflie"""
self._write_finished_cb = write_finished_cb
data = ()
data = bytearray()
for led in self.leds:
# In order to fit all the LEDs in one radio packet RGB565 is used
# to compress the colors. The calculations below converts 3 bytes
Expand All @@ -156,7 +156,7 @@ def write_data(self, write_finished_cb):
B5 = ((int)((((int(led.b) & 0xFF) * 249 + 1014) >> 11) & 0x1F) *
led.intensity / 100)
tmp = (int(R5) << 11) | (int(G6) << 5) | (int(B5) << 0)
data += (tmp >> 8, tmp & 0xFF)
data += bytearray((tmp >> 8, tmp & 0xFF))
self.mem_handler.write(self, 0x00, data, flush_queue=True)

def update(self, update_finished_cb):
Expand Down

0 comments on commit 26257e8

Please sign in to comment.