-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
V3.0.0 alpha2 Issues with esp32-hal-timer "update" #8776
Comments
Changes were required because of changes also in ESP-IDF. The new API is more Arduino-esque and conscious. Unfortunately sometimes breaking changes are necessary and here we are coming with a new major version, so it is allowed. Backwards compatibility is not always possible. @P-R-O-C-H-Y please help to convert to 3.0.0 code. |
@dagnall53 I will just change your code snippet to this:
For more information about new API you can check the Timer documentation |
@P-R-O-C-H-Y (thanks for code suggestion I will record that suggestion in my code in case I need to use it. ) (This is not a rant, just an honest set of questions!) First, and least problematic - timerAlarm() - This revised function will add a new "reload count limit" function that will be useful for some people, and retain the "number to count to". However, I would hope that the final esp32-hal-timer code could also retain the preexisting timerAlarmWrite() definition, to allow unmodified reuse of old source: such as the software serial port libraries. timerBegin() Here I am very confused. - Thanks for the discussion and education! |
here on your confusion: ESP-IDF used to also access the timers by number, so it made sense to keep that the same. Now though, ESP-IDF allocated those resources and gives you the next free timer instead. This makes sense for many reasons, but also required us to change API. So now you just ask for new timer (with timerBegin) and do not care which number it is. |
On the first: Since we already had to change API of some of the timer functions (read above) it made sense to also rename some of them to make more sense and follow better the Arduino style. Libraries that use the timers will need to adjust their code to support the new API now anyway, so doing that for one more function is not that problematic. Plus they might figure out that the new options fit their needs better. |
Also 2 more benefits of timer in 3.0:
|
@P-R-O-C-H-Y @me-no-dev |
Another great benefit is that every access to such timers should now use the same code to see which timer is free. |
@dagnall53 The migration guide to 3.0.0 is now available here |
@lucasssvaz thanks. Can I check your development terminology please. Do you use the term 'Breaking Changes' to mean changes that BREAK previous code? |
|
Thanks ! |
I think we can close this issue as answered. :) |
@VojtechBartoska @me-no-dev |
@dagnall53 |
@me-no-dev Thank you for replying! |
Do you see anything that you can do with the old API and can not do with the new one? It would make more sense to show that, than writing a whole soft serial. API has changed, but it's still a hardware timer that does the same thing |
Good question. |
and that is OK, because we are incrementing a major version that permits such breaking changes. The fact that we have changed some APIs in no way means that you will not be able to have SoftwareSerial or anything else. We provide header to check against the core version and libs can accommodate old and new support at the same time. We could not stay with the old API and progress is a normal thing. |
Board
ESP32 devboard
Device Description
Board is a data multiplexer
Hardware Configuration
N/A
Version
latest master (checkout manually)
IDE Name
2.2.1
Operating System
win10
Flash frequency
N/A
PSRAM enabled
yes
Upload speed
115200
Description
esp32-hal-timer library seems to have been significantly changed, which affects how previously good code will now compile.
I am not sure why this has occurred, but my code exposed a number of functions whose definitions have been (?unnecessarily?) altered in V3.0.0.
I would request that the "updates" for esp32-hal-timer be reviewed in detail for consistency with the previous versions, and corrected to ensure backwards compatibility and restore functionalty!
The specific functions that I noted had changed significantly were:
timerBegin
Changed from timerBegin(uint8_t num, uint16_t divider, bool countUp){
to timerBegin(uint32_t frequency){ !!
timerAlarmWrite Completely missing in new library
timerAlarmEnable Completely missing in new library
Comparison of the old esp32-hal-timer from 2.0.14 to the new one shows many other (? unnecessary ?) changes.
First noted in #8765
Sketch
example in hardware serial detector:
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: