From 26257e8a5d3ad5efb8b7fda86608a1e70f80f319 Mon Sep 17 00:00:00 2001 From: Marcus Eliasson Date: Mon, 7 Sep 2015 15:40:30 +0200 Subject: [PATCH] Fixed LED-ring memory compatibility with Python 3 (#96) --- lib/cflib/crazyflie/mem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cflib/crazyflie/mem.py b/lib/cflib/crazyflie/mem.py index 0633312e6e..7aae03b614 100644 --- a/lib/cflib/crazyflie/mem.py +++ b/lib/cflib/crazyflie/mem.py @@ -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 @@ -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):