Skip to content

Commit

Permalink
Fix SSD1306
Browse files Browse the repository at this point in the history
Simple fix to make SSD1306 work again.

Adding `displayio.release_displays()` might be needed for other backends if user is experiencing `ValueError: pin in use` on soft reboot.
  • Loading branch information
regicidalplutophage authored Aug 28, 2023
1 parent 61eabf5 commit 897729e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kmk/extensions/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def wake(self):


class SSD1306(DisplayBackend):
displayio.release_displays()
def __init__(self, i2c=None, sda=None, scl=None, device_address=0x3C):
displayio.release_displays()
self.device_address = device_address
# i2c initialization
self.i2c = i2c
Expand All @@ -148,7 +148,6 @@ def during_bootup(self, width, height, rotation):
width=width,
height=height,
rotation=rotation,
brightness=self.brightness,
)

return self.display
Expand Down Expand Up @@ -303,6 +302,7 @@ def during_bootup(self, keyboard):
del self.entries[idx]

self.display.during_bootup(self.width, self.height, 180 if self.flip else 0)
self.display.brightness=self.brightness

def before_matrix_scan(self, sandbox):
if self.dim_period.tick():
Expand Down

0 comments on commit 897729e

Please sign in to comment.