-
Notifications
You must be signed in to change notification settings - Fork 133
add esp.timer_get_time #1977
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
base: main
Are you sure you want to change the base?
add esp.timer_get_time #1977
Conversation
|
Thank you. I am confused by the division. AtomVM has been supporting signed int64_t for a while, but you need to box them with term_make_maybe_box_int64. term_from_int64 is bad and should be removed (see #1897). |
|
You mean term_make_maybe_boxed_int64 I suppose. I overlooked that, will change accordingly. I see a number of SUPPORT ifdefs, would my addition be right outside any? |
|
This is a nice addition, for the DCO CI you need to signoff your commits - https://docs.pi-hole.net/guides/github/how-to-signoff/ eg I'm fine with this not being tested, but you could add a test similar to https://github.com/atomvm/AtomVM/blob/main/src/platforms/esp32/test/main/test_erl_sources/test_monotonic_time.erl - maybe even just to that file.. |
8ec45cd to
8804e11
Compare
src/platforms/esp32/test/main/test_erl_sources/test_esp_timer_get_time.erl
Outdated
Show resolved
Hide resolved
src/platforms/esp32/test/main/test_erl_sources/test_esp_timer_get_time.erl
Outdated
Show resolved
Hide resolved
3507414 to
c7d87ae
Compare
|
Looks good, add a line to the changelog and squash commits - then it's should be ready! |
c7d87ae to
28c3677
Compare
src/platforms/esp32/test/main/test_erl_sources/test_esp_timer_get_time.erl
Outdated
Show resolved
Hide resolved
28c3677 to
cb160fc
Compare
|
complete nitpicks: Great work landing first PR! - not entirely easy;-) |
|
Thank you, the next one will be much harder...
I went with the original type... which overflows after ~300k years 😂 I made changes for the rest of the nitpicks. Thank you! |
|
It looks like the final commit message change did not make it over to this PR :/ |
|
Looks like you forgot to push the last nitpick fixes? |
|
I pushed to the source branch where this PR is from: https://github.com/schnittchen/AtomVM/tree/esp-dac I think it's just GH being stuck. I'll add a bogus commit, push, reset back, push again. |
cb160fc to
5364b08
Compare
|
There we go! I was on the wrong branch. |
5364b08 to
a10dca8
Compare
|
I'm not 100% sure the code is correct at this stage. I'm struggling with the build system and making sure all my changes get onto the device. For upcoming work, I added another Erlang module, added it to libs/eavmlib/src/CMakeLists.txt, rebuilt and re-flashed AtomVM, but the module could not be found. What steps do I need to take to make sure that Erlang code changes are picked up when creating and flashing AtomVM on ESP32? |
|
maybe join the telegram (most active) or the discord to get help - https://atomvm.org/contact/ you need to build in the AtomVM/build folder first to compile the erlang code and stdlibs - then complete the (esp32) build in the esp32 folder.. |
src/platforms/esp32/test/main/test_erl_sources/test_esp_timer_get_time.erl
Outdated
Show resolved
Hide resolved
a10dca8 to
804e7ec
Compare
I'm currently iterating by building everything from scratch. So far, the new functionality seems to work. |
Signed-off-by: schnittchen <[email protected]>
804e7ec to
b6f419e
Compare
I hope this addition is welcome. It's incomplete because I would like to get early feedback.
Originally I wanted to simply expose
esp_timer_get_time, but integer size restrictions make this tricky, so I decided to divide by 10^6 to be able to get the seconds since boot (or wakeup from sleep). This function should be useful at least for monitoring purposes.If you suggest a nice way to expose the full int64_t precision, I'll happily change the implementation (and name).
This is my first contribution and my first NIF code. Next up I would like to add support for ESP32's DAC, but let's start simple.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later