Refactor tune control & support broken single note playing functionality
Describe problem solved by this pull request
tune_control play -f 1500 -d 500000(Command to play a single note) was broken, so you couldn't actually use this single note play feature oftune_control- Whenever
tune_controluORB message was getting sent with the tune id ofTUNE_ID_STOP, it was actually making the tune library enterCUSTOMtune mode, which should only be used to play a custom frequency / duration.- The only reason nobody noticed this so far was because the CUSTOM tune has an "" (empty string) defined in the
tune_definitions.desc.
- The only reason nobody noticed this so far was because the CUSTOM tune has an "" (empty string) defined in the
- Rename and add comments to ambiguous parts of the code to improve readability
Describe your solution
- Support single note playing command in
tune_controlmodule appropriately - Added the STOP tune ID separately as a custom command / tune-id, and decouple it from original implementation where it mixed it up with CUSTOM tune id.
- Rename and re-structure
tune_descriptions.h and .cppto make the file / code more clear to the developers. - Remove
libtestcommand fromtune_control, as it doesn't seem to serve much purpose :shrug:
Test data / coverage
Tested on PixhawkV5X hardware (the following commands):

tune_control play -t 12tune_control play note -f 1500 -d 500000tune_control play errortune_control stop
Additional context
- [ ] I have removed the header inclusion from files like
src/drivers/drv_tone_alarm.h, is this ok? It seems to compile fine but wanted to make sure this isn't done accidentally.
Rebased on main
Still needed?
Well this PR fixes the broken feature, so I would say it's needed :thinking:
Resolved conflict and rebased on main
FYI @tstastny this is the PR that I mentioned that has been sitting for a while
Remove the sitl_gazebo submodule change?
Any implications for the other tune control subscribers (UAVCAN and tap_esc)?
Any implications for the other tune control subscribers (UAVCAN and tap_esc)?
I have tested on tap_esc (Mantis Edu), but not on UAVCAN 🤔
Adding motor resonance based tune control can be a fun addition: DSHOT, etc.
Also, Circuit Breaker for buzzer should be removed.
Also, silence mode for people who don't want tunes to play can be added (Daniel and Jay wants this!)