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):
3030button .switch_to_input (pull = digitalio .Pull .UP )
3131
3232display = board .DISPLAY
33-
34- # Take over display to drive directly
3533display .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
3838files = get_files ("/" )
3939for 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