Skip to content

pewpew10 - use _pew.get_ticks() for time tracking #4980

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

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

deshipu
Copy link

@deshipu deshipu commented Jul 9, 2021

Somehow PR #4200 got
reverted, repeating it, with a proper tag.

Somehow PR adafruit#4200 got
reverted, repeating it, with a proper tag.
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Sorry for the regression! Submodules are a bit tricky.

@tannewt tannewt merged commit 9034867 into adafruit:main Jul 12, 2021
@deshipu
Copy link
Author

deshipu commented Jul 12, 2021

It's my fault for failing to tag it correctly.

By the way, this interrupt disabling in the time functions may still be affecting other modules, like pulseio, pwmio, or audioio, so maybe it would be good to revisit it when there is some time.

@deshipu deshipu deleted the pewpew-fixx branch July 12, 2021 20:28
@dhalbert
Copy link
Collaborator

By the way, this interrupt disabling in the time functions may still be affecting other modules, like pulseio, pwmio, or audioio, so maybe it would be good to revisit it when there is some time.

Could you elaborate on this? I am thinking there might be issues about this elsewhere as well. What did you fix in your own code? Thanks.

@deshipu
Copy link
Author

deshipu commented Jul 17, 2021

I basically count the frames in _pew and use that for timekeeping in the pew library, so that I don't have to use time.monotonic() or time.sleep(), which both have code that disables the interrupts for a time to read a multi-byte register atomically.

@dhalbert
Copy link
Collaborator

Are you saying the interrupt disabling in time.sleep() etc. loses ticks, or just delays them?

@deshipu
Copy link
Author

deshipu commented Jul 17, 2021

What's the difference between a lost timer tick and a delayed one?

@dhalbert
Copy link
Collaborator

If the tick incrementer loses ticks, then the time "clocks" will run slow. If the time incrementer ticks are delayed, then there will be jitter in the time reporting, but we won't lose time in the long run. But I think I may be missing your point.

@deshipu
Copy link
Author

deshipu commented Jul 17, 2021

Oh, so you would get clumps of ticks, but on average the number of ticks would be correct? Considering that the brightness of the LEDs is affected (see the horizontal lines on the last video), I would say they are getting lost, but I can't be certain if the background flicker that is also present is not due to them also being delayed/clumped.

@deshipu
Copy link
Author

deshipu commented Jul 17, 2021

I made some signal captures on the original issue #3504 — maybe that will be helpful.

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