Skip to content

Commit 3b47577

Browse files
committed
Disable display refresh during update in Matrix8x8
In Matrix8x8.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 e8e0bf7 commit 3b47577

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
@@ -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

0 commit comments

Comments
 (0)