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

Fix #3504: Don't use time module in pew.tick() #3536

Merged
merged 2 commits into from
Feb 8, 2021

Conversation

deshipu
Copy link

@deshipu deshipu commented Oct 10, 2020

The time.sleep() and time.monotonic() functions break the timer
interrupt on which PewPew10 display relies, so we can't use them
anymore. Instead I'm adding a time-keeping function to the display
code itself, which then can be used in pew.tick() internally.

The time.sleep() and time.monotonic() functions break the timer
interrupt on which PewPew10 display relies, so we can't use them
anymore. Instead I'm adding a time-keeping function to the display
code itself, which then can be used in pew.tick() internally.
@deshipu
Copy link
Author

deshipu commented Oct 10, 2020

This is a proof of concept for the fix. If we agree to it, I will also need to add a corresponding code change to the frozen pew.py library to make use of this function.

@tannewt
Copy link
Member

tannewt commented Oct 12, 2020

I replied on the issue. I suspect we won't need this.

@deshipu
Copy link
Author

deshipu commented Oct 13, 2020

Fixed by #3546

@deshipu deshipu closed this Oct 13, 2020
@deshipu
Copy link
Author

deshipu commented Feb 5, 2021

I would like to reopen this pull request. If I avoid relying on the time.monotonic() entirely, there is zero flicker in PewPew, and I don't run into problems with lowering accuracy over time.

@deshipu deshipu reopened this Feb 5, 2021
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK by me, since it doesn't change anything else except your own library.

@dhalbert
Copy link
Collaborator

dhalbert commented Feb 8, 2021

If we had some kind of ticks_ms() routine that wrapped around for non-longints, would that be useful to you instead?

@deshipu
Copy link
Author

deshipu commented Feb 8, 2021

No, an important feature here is that it doesn't use the timekeeping/sleep machinery, and so doesn't trigger the flickering.

@dhalbert dhalbert merged commit 3a68ac8 into adafruit:main Feb 8, 2021
@tannewt
Copy link
Member

tannewt commented Feb 9, 2021

I don't think it's the timekeeping/sleep machinery causing you problems. All of those things are still happening. I'd blame monotonic's degrading accuracy if anything.

@deshipu
Copy link
Author

deshipu commented Feb 16, 2021

In any case, this solves the problem and makes it unlikely to ever come back, which is important for me from the maintenance point of view.

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

Successfully merging this pull request may close these issues.

3 participants