42 Commits

Author SHA1 Message Date
Alex Mikhalev
9e57c5d217 tunes: Print warning if there is a tune error 2022-03-30 09:58:33 -04:00
Alex Mikhalev
f6cda64f0d tunes: Fixed unspecified behaviour
This fixes unspecified behaviour due to evaluation order of args.
It's up to the compiler whether next_number() or next_dots() is executed
first which means that the behaviour is not properly specified.
2022-03-30 09:58:33 -04:00
Daniel Agar
33954a904f lib/tunes: never play tunes if circuit breaker is set 2021-10-18 21:37:09 -04:00
Alex Mikhalev
378b41af6a tunes: Improve logic for interrupting tunes
src/lib/tunes already knows which tunes are interruptable, so add
return values to expose than and use than in tone_alarm.
This fixes the issue that repeating tunes cannot be interrupted without
tune_override set to true.

Signed-off-by: Alex Mikhalev <alex@corvus-robotics.com>
2020-11-30 16:56:13 -05:00
Daniel Agar
08bf71b73d
drivers/tone_alarm and tune_control small improvements/cleanup
- drivers/tone_alarm: move to ModuleBase and purge CDev (/dev/tone_alarm0)
 - drivers/tone_alarm: only run on tune_control publication (or scheduled note) rather than continuously
 - drivers/tone_alarm: use HRT to schedule tone stop (prevents potential disruption)
 - msg/tune_control: add tune_id numbering
 - systemcmds/tune_control: add "error" special case tune_id
 - move all tune_control publication to new uORB::PublicationQueued<>
 - start tone_alarm immediately after board defaults are loaded to fix potential startup issues
 - for SITL (or other boards with no TONE output) print common messages (startup, error, etc)
2020-10-05 21:39:26 -04:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Beat Küng
800266741b Merge pull request #12063 from PX4/fix_custom_tune
fix tunes: make sure a custom tune gets played
2019-05-25 17:58:44 +02:00
Alessandro Simovic
3d668d871b tunes: don't let tune interrupt itself 2019-03-29 19:42:02 -07:00
mcsauder
31f23c1e76 Rename tune_control_s strength to volume to match Nuttx and Linux standard nomenclature for audio (loudness) control. 2019-02-19 10:07:53 +01:00
mcsauder
a6d186dfed Rename Tunes::get_next_tune() to Tunes::get_next_note(). 2019-02-19 08:00:11 +01:00
Mark Sauder
352be14bbe Alphabetizing/standardizing orders in tunes.cpp and tunes.h files
- Remove a constructor overload by adding default values, and disambiguate a few variables by adding verbosity to naming.
2019-02-10 20:31:12 -05:00
Daniel Agar
2ffb49b734 delete px4_includes.h header and update boards/ to use syslog 2019-01-23 18:25:18 -05:00
David Sidrane
ab26bd76ff tunes:Refactor for maintenance
Adds a single file definition to provide a single point to add
    new tunes and clearly understand, the useage: it need to be
    stopped will it not allow interruption.
2018-08-30 19:11:17 +02:00
Alessandro Simovic
9d3dfb7864 libtunes: addressing comments of #9117 2018-03-26 14:54:23 +02:00
Alessandro Simovic
6e1c495268 libtunes: added TUNE_MAX_STRENGTH 2018-03-26 14:54:23 +02:00
Alessandro Simovic
80d80835a0 libtunes: fixed some type conversions and other minor changes 2018-03-26 14:54:23 +02:00
Alessandro Simovic
92b89368f1 libtunes: fixed playback of string melodies 2018-03-26 14:54:23 +02:00
Alessandro Simovic
7d9b09b5e5 libtunes: made logic in Tunes::set_control() more obvious 2018-03-26 14:54:23 +02:00
Alessandro Simovic
4e479b7f04 libtunes: renamed config_tone() to reset() 2018-03-26 14:54:23 +02:00
Alessandro Simovic
6ce839ea1e libtunes: added tone strength as state and output to libtunes
Since the tune library also contains logic how tunes can be overriden,
a user of the tunes library cannot know the strength of the current tune
without replicating some logic. Easy solution is to add strength to the
output of Tunes::get_next_tune().
2018-03-26 14:54:23 +02:00
Alessandro Simovic
acdc81ea0a libtunes: cleanup / docs 2018-03-26 14:54:23 +02:00
Alessandro Simovic
d455c1e7e1 libtunes: Repeating tunes can be interrupted without override
Otherwise the only way of interrupting a repeated tune would be with the override flag, which should only be used rarely.
Now repeating tunes have lowest priority, followed by one-shot tunes, followed by anything with an override flag.
2018-03-26 14:54:23 +02:00
Alessandro Simovic
34836a2b21 libtunes: allow custom tune (id 0) to be used to stop playback.
Override flag must still be set to true!
2018-03-26 14:54:23 +02:00
Alessandro Simovic
2cf93df918 libtunes: _repeat was uninitialized. Defaulting to false now.
Bugfix: This fixes a bug where libtunes might indicate that there are more tones to play even after the last note of a tune.
2018-03-26 14:54:23 +02:00
Alessandro Simovic
f47443f283 libtunes: (bugfix) sending a custom msg tune overrides everything
Custom msg tune can override any tune playing, regardless of the tune_override flag.
2018-03-26 14:54:23 +02:00
Martina
be275b880b tunes: add fallthrough macro 2018-03-19 14:15:52 +01:00
Simone Guscetti
879c698cab libtunes: Change TuneID::ERROR in ERROR_TUNE
This prevents the expanction of the ERROR macro inside the TuneID enum
2018-03-19 14:15:52 +01:00
Simone Guscetti
4c6daf0748 libtunes: Update tunes and mkblctrl to use the tune_definition 2018-03-19 14:15:52 +01:00
Simone Guscetti
47e5382e7e libtunes: insert explicit fallthrough 2018-01-29 09:45:59 -05:00
Simone Guscetti
9cb95b64ca libtunes: change variable name
This make the variable purpose more clear.
2018-01-29 09:45:59 -05:00
Martina
2ec5ea48a3 tunes: for custom tunes set silence from tune control message and set
silence to 0 when the end of the string is reached
2018-01-29 09:45:59 -05:00
Martina
1988141c6d tunes: add pointer to the beginning of a tune to allow tune replay 2018-01-29 09:45:59 -05:00
Simone Guscetti
f63be6b055 libtunes: If default tune does not exist
return -EINVAL
2018-01-29 09:45:59 -05:00
Simone Guscetti
915f728145 libtunes: Separate the default tunes from tunes.cpp 2018-01-29 09:45:59 -05:00
Simone Guscetti
591f9a8a38 libtunes: Handle notification tunes as high priority 2018-01-29 09:45:59 -05:00
Simone Guscetti
3f123acd7e libtunes: handle tune override 2018-01-29 09:45:59 -05:00
Simone Guscetti
6c8b16391e libtunes: complete API doc, minor changes 2018-01-29 09:45:59 -05:00
Simone Guscetti
b84a97c6d5 libtunes: Changed to a set_control/string and a get_next_tune functions
Now it is possible to set a string and a control.
The get_next_tune function use the same return values as the erliaer
implemented parse_cmd and parse_string functions.
2018-01-29 09:45:59 -05:00
Simone Guscetti
5214642bc3 tunes lib: Minor changes 2018-01-29 09:45:59 -05:00
Simone Guscetti
e9ea7ab698 lib tunes: clean up 2018-01-29 09:45:59 -05:00
Simone Guscetti
79ae413982 lib tunes: Add string input method 2018-01-29 09:45:59 -05:00
Simone Guscetti
8ce57bedb7 libtunes: create a new library for tunes
cmake configs: Modify to include new library
2018-01-29 09:45:59 -05:00