From 3b475777a12bf5f9cb9b4a7ff8851f9f69308d32 Mon Sep 17 00:00:00 2001 From: Steve Kay Date: Wed, 10 Feb 2021 23:25:31 -0800 Subject: [PATCH 1/2] 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. --- adafruit_ht16k33/matrix.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adafruit_ht16k33/matrix.py b/adafruit_ht16k33/matrix.py index f61d2db..2c9f968 100755 --- a/adafruit_ht16k33/matrix.py +++ b/adafruit_ht16k33/matrix.py @@ -124,10 +124,13 @@ def image(self, img): ) # Grab all the pixels from the image, faster than getpixel. pixels = img.convert("1").load() + auto_write = self.auto_write + self._auto_write = False # Iterate through the pixels for x in range(self.columns): # yes this double loop is slow, for y in range(self.rows): # but these displays are small! self.pixel(x, y, pixels[(x, y)]) + self._auto_write = auto_write if self._auto_write: self.show() From 6fe369270605b33a3a37b96cdcf6e5d9718b69d2 Mon Sep 17 00:00:00 2001 From: Steve Kay Date: Wed, 10 Feb 2021 23:31:20 -0800 Subject: [PATCH 2/2] 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. --- adafruit_ht16k33/matrix.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adafruit_ht16k33/matrix.py b/adafruit_ht16k33/matrix.py index 2c9f968..5bffbe6 100755 --- a/adafruit_ht16k33/matrix.py +++ b/adafruit_ht16k33/matrix.py @@ -217,6 +217,8 @@ def image(self, img): ) # Grab all the pixels from the image, faster than getpixel. pixels = img.convert("RGB").load() + auto_write = self.auto_write + self._auto_write = False # Iterate through the pixels for x in range(self.columns): # yes this double loop is slow, for y in range(self.rows): # but these displays are small! @@ -229,5 +231,6 @@ def image(self, img): else: # Unknown color, default to LED off. self.pixel(x, y, self.LED_OFF) + self._auto_write = auto_write if self._auto_write: self.show()