Skip to content

MatrixPortal : solution to refresh the clock every second #83

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

Open
kabcasa opened this issue Mar 13, 2022 · 4 comments
Open

MatrixPortal : solution to refresh the clock every second #83

kabcasa opened this issue Mar 13, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@kabcasa
Copy link

kabcasa commented Mar 13, 2022

I have a clock that needs to be updated every second on a first line and a second line that displays scrolling text.
currently the clock is only updated at the end of line 2 scrolling.
I am looking for a solution to refresh the clock every second independently of line 2

i have set the matrix :
<

# Matrix setup
print('Matrix Setup')
matrixportal = MatrixPortal(
    url = URL,
    json_path=FORECAST_TYPE,
    status_neopixel = board.NEOPIXEL,
    debug=True,
)

print('Text Setup')
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(10, 5),
    text_color=0xFF8080
)
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(0, 20),
    text_color=0x3ABCBC,
    scrolling=True
)

and for display :
<

matrixportal.set_text(curtime, 0)
matrixportal.set_text(next_station_in, 1)
matrixportal.scroll_text(SCROLL_DELAY)
time.sleep(0.03) 

I could get the clock update every second when using matrix.scroll() but get an issue
File "adafruit_matrixportal/matrixportal.py", line 231, in scroll
AttributeError: 'NoneType' object has no attribute 'x'

<
```
matrixportal.set_text(curtime, 0)
matrixportal.scroll()
matrixportal.set_text(next_station_in, 1)
matrixportal.scroll_text(SCROLL_DELAY)
time.sleep(0.03)

>


@makermelissa
Copy link
Collaborator

I'm pretty sure that's not possible with how it's currently coded. Now that asyncio is working in CircuitPython, this part could be rewritten.

@makermelissa makermelissa added the enhancement New feature or request label Mar 14, 2022
@kabcasa
Copy link
Author

kabcasa commented Mar 14, 2022

@makermelissa
thanks for these informations. I have practically no asyncio experience, on your side do you have an example how to do it.

@makermelissa
Copy link
Collaborator

makermelissa commented Mar 14, 2022

I haven't really used it, but here's a great guide on how to use it and what I would start with myself:
https://learn.adafruit.com/cooperative-multitasking-in-circuitpython-with-asyncio

@lmurdock12
Copy link

Did you ever find an implementation solution? @kabcasa

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

No branches or pull requests

3 participants