Backend crashes when function called for second time
HabibMCS opened this issue · 3 comments
HabibMCS commented
import utime
import s3lcd
import tft_config
import font as font
from machine import reset_cause
tft = tft_config.config( 1,0)
def showscrolltext(char1 , fg = s3lcd.WHITE, bg = s3lcd.RED, pady=60, xs = -1, ys = 0, duration = 40):
try:
tft_config.config( 1,0,backlight = 1)
tft.init()
curr = utime.time()
tft.fill(bg)
height = tft.height()
width = tft.width()
line = height - font.HEIGHT
while utime.time() - curr < duration:
for c in char1:
tft.write(font,c,width - font.WIDTH*2,line-pady,fg,bg,)
for _ in range(font.HEIGHT // 2):
tft.scroll(xs, ys)
tft.show()
utime.sleep(3)
finally:
tft_config.deinit(tft, display_off = True)
print("scroll completed")
showscrolltext(' Hey its test for display 7809', duration = 5 )
utime.sleep(5)
showscrolltext(' Hey its test for display 7809', duration = 5 ) # when this line is called it crashes
when the function is called second time the esp32s3 t display crashes. I would appreciate if someone helps on this. Thanks in advance
russhughes commented
What does your tft_config.py look like?
HabibMCS commented
Hi, It was same as tft_config.py from t display s3.
It was fixed when I called tft = tft_config.config( 1,0)
within in the function. Seems like, when we deinit() the instance has to be called again.
HabibMCS commented
Thanks for your reply