diff --git a/adafruit_pypixelbuf.py b/adafruit_pypixelbuf.py index f36aded..66189fc 100644 --- a/adafruit_pypixelbuf.py +++ b/adafruit_pypixelbuf.py @@ -61,6 +61,8 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments bpp, byteorder_tuple, has_white, dotstar_mode = self.parse_byteorder(byteorder) + self.auto_write = False + effective_bpp = 4 if dotstar_mode else bpp _bytes = effective_bpp * n buf = bytearray(_bytes) @@ -89,8 +91,6 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments self._dotstar_mode = dotstar_mode self._pixel_step = effective_bpp - self.auto_write = auto_write - if dotstar_mode: self._byteorder_tuple = ( byteorder_tuple[0] + 1, @@ -102,6 +102,8 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments self._brightness = 1.0 self.brightness = brightness + self.auto_write = auto_write + @staticmethod def parse_byteorder(byteorder): """ diff --git a/examples/pypixelbuf_simpletest.py b/examples/pypixelbuf_simpletest.py index 2fe22e1..76a92bd 100644 --- a/examples/pypixelbuf_simpletest.py +++ b/examples/pypixelbuf_simpletest.py @@ -12,7 +12,7 @@ def _transmit(self, buffer): # pylint: disable=unused-argument self.called = True -buf = TestBuf(20, "RGBW", 1.0, auto_write=True) +buf = TestBuf(20, "RGBW", brightness=0.5, auto_write=True) buf[0] = (1, 2, 3) buf[1] = (1, 2, 3, 4) buf[2] = (2, 2, 2)