Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit 939fb82

Browse files
authored
Merge pull request #21 from dunkmann00/move-auto_write
Set auto_write after brightness in init
2 parents 1c31111 + 05c06a3 commit 939fb82

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

adafruit_pypixelbuf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments
6161

6262
bpp, byteorder_tuple, has_white, dotstar_mode = self.parse_byteorder(byteorder)
6363

64+
self.auto_write = False
65+
6466
effective_bpp = 4 if dotstar_mode else bpp
6567
_bytes = effective_bpp * n
6668
buf = bytearray(_bytes)
@@ -89,8 +91,6 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments
8991
self._dotstar_mode = dotstar_mode
9092
self._pixel_step = effective_bpp
9193

92-
self.auto_write = auto_write
93-
9494
if dotstar_mode:
9595
self._byteorder_tuple = (
9696
byteorder_tuple[0] + 1,
@@ -102,6 +102,8 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments
102102
self._brightness = 1.0
103103
self.brightness = brightness
104104

105+
self.auto_write = auto_write
106+
105107
@staticmethod
106108
def parse_byteorder(byteorder):
107109
"""

examples/pypixelbuf_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def _transmit(self, buffer): # pylint: disable=unused-argument
1212
self.called = True
1313

1414

15-
buf = TestBuf(20, "RGBW", 1.0, auto_write=True)
15+
buf = TestBuf(20, "RGBW", brightness=0.5, auto_write=True)
1616
buf[0] = (1, 2, 3)
1717
buf[1] = (1, 2, 3, 4)
1818
buf[2] = (2, 2, 2)

0 commit comments

Comments
 (0)