It's smooth now!
This commit is contained in:
parent
03d1f8313c
commit
3c966dc69f
@ -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,36 +101,36 @@ 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 view[3] == layer or view[3] is None:
|
if self._dark is False:
|
||||||
if view[4] == OledEntryType.TXT:
|
if view[3] == layer or view[3] is None:
|
||||||
splash.append(
|
if view[4] == OledEntryType.TXT:
|
||||||
label.Label(
|
splash.append(
|
||||||
terminalio.FONT,
|
label.Label(
|
||||||
text=view[0],
|
terminalio.FONT,
|
||||||
color=0xFFFFFF if not view[9] else 0x000000,
|
text=view[0],
|
||||||
background_color=0x000000 if not view[9] else 0xFFFFFF,
|
color=0xFFFFFF if not view[9] else 0x000000,
|
||||||
anchor_point=(view[5], view[6]),
|
background_color=0x000000 if not view[9] else 0xFFFFFF,
|
||||||
anchored_position=(
|
anchor_point=(view[5], view[6]),
|
||||||
view[1] if not view[9] else view[1] + 1,
|
anchored_position=(
|
||||||
view[2],
|
view[1] if not view[9] else view[1] + 1,
|
||||||
),
|
view[2],
|
||||||
label_direction=view[7],
|
),
|
||||||
line_spacing=view[8],
|
label_direction=view[7],
|
||||||
padding_left=1,
|
line_spacing=view[8],
|
||||||
|
padding_left=1,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
elif view[4] == OledEntryType.IMG:
|
||||||
elif view[4] == OledEntryType.IMG:
|
splash.append(
|
||||||
splash.append(
|
displayio.TileGrid(
|
||||||
displayio.TileGrid(
|
view[0],
|
||||||
view[0],
|
pixel_shader=view[0].pixel_shader,
|
||||||
pixel_shader=view[0].pixel_shader,
|
x=view[1],
|
||||||
x=view[1],
|
y=view[2],
|
||||||
y=view[2],
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
self._display.show(splash)
|
self._display.show(splash)
|
||||||
|
|
||||||
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user