This repository was archived by the owner on Sep 16, 2024. It is now read-only.
utime: Revert back the ticks_xxx functions to use short ints. 8000 #235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ticks_xx functions wrap around at a certain value. For the initial micropython, this values is 2^30-1 (MP short int). For the pycom port, it is 2^32-1. Thats done by simply using C 32 bit integers. This implementation has two drawbacks:
to deal with. That may hurt if for instance ticks_diff and ticks_xx are used a tight timing loop.
So this PR just goes back to the initial code, with was still present in the codebase and just had to be enabled with a config flag in mpconfigport.h.
Only ticks_cpu() is kept, limited to a 2^30 period, since different from the mp.org version is counts us ticks and the timing call is also used by the SX1272 and SX1276 driver. Side effects on the Lora nanogateway have to be tested yet, but I am pretty confident that it works. The ticks_cpu() call itself behaves well with ticks_diff().