Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend crashes when function called for second time #9

Closed
HabibMCS opened this issue Jul 17, 2023 · 3 comments
Closed

Backend crashes when function called for second time #9

HabibMCS opened this issue Jul 17, 2023 · 3 comments

Comments

@HabibMCS
Copy link

HabibMCS commented Jul 17, 2023

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
Copy link
Owner

What does your tft_config.py look like?

@HabibMCS
Copy link
Author

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
Copy link
Author

Thanks for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants