Skip to content

Commit 84bb364

Browse files
authored
Merge pull request #86 from SAK917/master
Disable matrix refresh during update using image() (Fixes #78)
2 parents 63c68f1 + 6fe3692 commit 84bb364

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

adafruit_ht16k33/matrix.py

+6
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,13 @@ def image(self, img):
124124
)
125125
# Grab all the pixels from the image, faster than getpixel.
126126
pixels = img.convert("1").load()
127+
auto_write = self.auto_write
128+
self._auto_write = False
127129
# Iterate through the pixels
128130
for x in range(self.columns): # yes this double loop is slow,
129131
for y in range(self.rows): # but these displays are small!
130132
self.pixel(x, y, pixels[(x, y)])
133+
self._auto_write = auto_write
131134
if self._auto_write:
132135
self.show()
133136

@@ -214,6 +217,8 @@ def image(self, img):
214217
)
215218
# Grab all the pixels from the image, faster than getpixel.
216219
pixels = img.convert("RGB").load()
220+
auto_write = self.auto_write
221+
self._auto_write = False
217222
# Iterate through the pixels
218223
for x in range(self.columns): # yes this double loop is slow,
219224
for y in range(self.rows): # but these displays are small!
@@ -226,5 +231,6 @@ def image(self, img):
226231
else:
227232
# Unknown color, default to LED off.
228233
self.pixel(x, y, self.LED_OFF)
234+
self._auto_write = auto_write
229235
if self._auto_write:
230236
self.show()

0 commit comments

Comments
 (0)