It's smooth now!

This commit is contained in:
regicidal.plutophage 2023-03-02 23:38:18 +00:00
parent 03d1f8313c
commit 3c966dc69f

View File

@ -73,8 +73,8 @@ class Oled(Extension):
device_address=0x3C, device_address=0x3C,
brightness=0.8, brightness=0.8,
brightness_step=0.1, brightness_step=0.1,
dim_time=30, dim_time=3,
off_time=60, off_time=6,
): ):
displayio.release_displays() displayio.release_displays()
self.rotation = 180 if flip else 0 self.rotation = 180 if flip else 0
@ -101,9 +101,9 @@ class Oled(Extension):
def render_oled(self, layer, *args, **kwargs): def render_oled(self, layer, *args, **kwargs):
splash = displayio.Group() splash = displayio.Group()
splash.hidden = False if not self._dark else True
for view in self._views: for view in self._views:
if self._dark is False:
if view[3] == layer or view[3] is None: if view[3] == layer or view[3] is None:
if view[4] == OledEntryType.TXT: if view[4] == OledEntryType.TXT:
splash.append( splash.append(
@ -159,10 +159,8 @@ class Oled(Extension):
def before_matrix_scan(self, sandbox): def before_matrix_scan(self, sandbox):
self.dim() self.dim()
if self._dark != self._go_dark: if self._dark != self._go_dark or sandbox.active_layers[0] != self._prevLayers:
self._dark = self._go_dark self._dark = self._go_dark
self.updateOLED(sandbox)
elif sandbox.active_layers[0] != self._prevLayers:
self._prevLayers = sandbox.active_layers[0] self._prevLayers = sandbox.active_layers[0]
self.updateOLED(sandbox) self.updateOLED(sandbox)
return return