Skip to content

display.clear() does not stop display.show(loop=True, wait=False) #150

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

Closed
microbit-carlos opened this issue Mar 17, 2023 · 3 comments
Closed
Milestone

Comments

@microbit-carlos
Copy link
Contributor

microbit-carlos commented Mar 17, 2023

Reported in the V1 repository, but I think it's actually a V2 only issue:

With this programme pressing button A should stop the animation looping forever by using display.clear(), but it only clears the current image displayed and the next animation steps continue.

Pressing B replaces the animation by just displaying a letter and at that point display.clear() works as expected.

from microbit import *

display.show("hello", loop=True, wait=False)
while True:
    sleep(100)
    if button_a.is_pressed():
        display.clear()
    if button_b.is_pressed():
        display.show("X")

In V1 display.clear() does stop the animation.

@davidtkaye
Copy link

Can confirm this is a problem on my V2 microbit, also coincidentally shows up on the microbit simulator in the online Python editor (where I first identified it).

@microbit-carlos microbit-carlos added this to the 2.1.2 milestone Mar 20, 2023
dpgeorge added a commit that referenced this issue Mar 27, 2023
Following the semantics of micro:bit v1.

Fixes issue #150.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Collaborator

Thanks for the report. Should be fixed by a5dd649

@dpgeorge
Copy link
Collaborator

@microbit-matt-hillsdon for the simulator you can now remove microbit_hal_display_clear(), per 5177bdc

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

3 participants