-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refactor beeper #13492
Refactor beeper #13492
Conversation
- beeperSequenceAdvance is used to advance beeperPos - sequences starting with 0 (delay first) are handled correctly - 'empty' beeper states are supressed - leds do blink beeper sequence, even when beeper is silenced
- simpler length definition - helpper function to simplify beep generation
Refuse modes where beeperTableEntry->sequence is NULL Rest of code is refactored without functional changes
- beeperNextToggleTime==0 when not enabled - lastDshotBeaconCommandTimeUs is updated during DSHOT_BEACON_GUARD_DELAY_US phase - DSHOT_BEACON_ALLOWED_MODES instead of explicit tests
- improve comments - add STATIC_ASSERT - reformat some code - move #ifdef to better follow semantic structure - return unsigned from BEEPER_GET_FLAG
Do you want to test this code? You can flash it directly from Betaflight Configurator:
WARNING: It may be unstable. Use only for testing! |
There are some open problems with beeper:
|
src/main/io/beeper.c
Outdated
#ifndef BEEPER_PWM_HZ | ||
#define BEEPER_PWM_HZ 0 | ||
#endif | ||
# ifndef BEEPER_PWM_HZ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal do not like indentation for macro's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll remove it. But it is confusing with deeper nesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree but could not find formal code guidelines on macro indentation as the code base uses them flat all over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there are 61 lines with indented macros. But it seems that I had written almost all of them and nobody was adventurous enough to change them back ;-)
As far as I can tell, motors only beep for Rx loss and Rx set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with my existing beeper build, all beeps worked normally.
No coding suggestions to make
4.5 or 4.6? |
If there is nothing to fix - this would be 4.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- approving untested.
- @ctzsnooze had a suggestion/question regarding potential single-motor-beep to be considered.
@ledvinap please rebase |
Merged upstream |
Comments are in individual commits