Skip to content

Commit 6fe3692

Browse files
committed
Disable refresh during update in Matrix8x8x2
In Matrix8x8x2.image(), store current auto_write state in temp variable and set auto_write to False before looping to update all pixels in the matrix. Once done updating, restore auto_write state to previous setting.
1 parent 3b47577 commit 6fe3692

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_ht16k33/matrix.py

+3
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ def image(self, img):
217217
)
218218
# Grab all the pixels from the image, faster than getpixel.
219219
pixels = img.convert("RGB").load()
220+
auto_write = self.auto_write
221+
self._auto_write = False
220222
# Iterate through the pixels
221223
for x in range(self.columns): # yes this double loop is slow,
222224
for y in range(self.rows): # but these displays are small!
@@ -229,5 +231,6 @@ def image(self, img):
229231
else:
230232
# Unknown color, default to LED off.
231233
self.pixel(x, y, self.LED_OFF)
234+
self._auto_write = auto_write
232235
if self._auto_write:
233236
self.show()

0 commit comments

Comments
 (0)