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

Ensure millisecond precision in read_response() #35

Merged
merged 1 commit into from
May 31, 2020

Conversation

fgervais
Copy link
Contributor

The micropython documentation for utime.time() states that on
some hardware, the function only have second precision.

This is the case at least for the TinyPICO board.

This means that we get an effective 1 second timeout for the
read_response() function instead of the expected 50ms. In turn,
it makes the run() function quite slow which delays the whole
application.

To get higher precision, the documentation recommends to use
utime.ticks_ms() instead which is what have been implemented
here.

The micropython documentation for utime.time() states that on
some hardware, the function only have second precision.

This is the case at least for the TinyPICO board.

This means that we get an effective 1 second timeout for the
read_response() function instead of the expected 50ms. In turn,
it makes the run() function quite slow which delays the whole
application.

To get higher precision, the documentation recommends to use
utime.ticks_ms() instead which is what have been implemented
here.
Copy link
Collaborator

@antohaUa antohaUa left a comment

Choose a reason for hiding this comment

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

Agree better to measure here with ticks_diff. Thx for found case.

@antohaUa antohaUa merged commit 6832b99 into blynkkk:master May 31, 2020
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.

2 participants