Skip to content

Commit 025ddf2

Browse files
authored
Merge pull request #2474 from adafruit/TheKitty-patch-6
Change direct write code for Feather to add correct offset
2 parents d74e01f + 7915389 commit 025ddf2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CircuitPython_gifio/Feather/code-multi-feather-direct.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: MIT
44
#
5-
# Play Multiple GIF files on a n ESP32-S2 Feather TFT
5+
# Play Multiple GIF files on an ESP32-S2 Feather TFT
66
# Requires CircuitPython 8.1.0-beta.1 or later
77
# Updated 4/4/2023
88

@@ -30,10 +30,10 @@ def get_files(base):
3030
button.switch_to_input(pull=digitalio.Pull.UP)
3131

3232
display = board.DISPLAY
33-
34-
# Take over display to drive directly
3533
display.auto_refresh = False
36-
display_bus = display.bus
34+
35+
COL_OFFSET = 40 # The Feather TFT needs to have the display
36+
ROW_OFFSET = 53 # offset by these values for direct writes
3737

3838
files = get_files("/")
3939
for i in range(len(files)):
@@ -58,9 +58,11 @@ def get_files(base):
5858
print("Button Press, Advance\n")
5959
break
6060
next_delay = odg.next_frame()
61-
display_bus.send(42, struct.pack(">hh", 0, odg.bitmap.width - 1))
62-
display_bus.send(43, struct.pack(">hh", 0, odg.bitmap.height - 1))
63-
display_bus.send(44, odg.bitmap)
61+
display.bus.send(42, struct.pack(">hh", COL_OFFSET,
62+
odg.bitmap.width - 1 + COL_OFFSET))
63+
display.bus.send(43, struct.pack(">hh", ROW_OFFSET,
64+
odg.bitmap.height - 1 + ROW_OFFSET))
65+
display.bus.send(44, odg.bitmap)
6466
# End while
6567
# Clean up memory
6668
odg.deinit()

0 commit comments

Comments
 (0)