mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
libtunes: renamed config_tone() to reset()
This commit is contained in:
committed by
Beat Küng
parent
6ce839ea1e
commit
4e479b7f04
@@ -59,14 +59,14 @@ Tunes::Tunes(unsigned default_tempo, unsigned default_octave, unsigned default_n
|
|||||||
_default_mode(default_mode),
|
_default_mode(default_mode),
|
||||||
_default_octave(default_octave)
|
_default_octave(default_octave)
|
||||||
{
|
{
|
||||||
config_tone(false);
|
reset(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tunes::Tunes(): Tunes(TUNE_DEFAULT_TEMPO, TUNE_DEFAULT_OCTAVE, TUNE_DEFAULT_NOTE_LENGTH, NoteMode::NORMAL)
|
Tunes::Tunes(): Tunes(TUNE_DEFAULT_TEMPO, TUNE_DEFAULT_OCTAVE, TUNE_DEFAULT_NOTE_LENGTH, NoteMode::NORMAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tunes::config_tone(bool repeat_flag)
|
void Tunes::reset(bool repeat_flag)
|
||||||
{
|
{
|
||||||
// reset pointer
|
// reset pointer
|
||||||
if (!repeat_flag) {
|
if (!repeat_flag) {
|
||||||
@@ -122,7 +122,7 @@ int Tunes::set_control(const tune_control_s &tune_control)
|
|||||||
case static_cast<int>(TuneID::NOTIFY_NEUTRAL):
|
case static_cast<int>(TuneID::NOTIFY_NEUTRAL):
|
||||||
case static_cast<int>(TuneID::NOTIFY_NEGATIVE):
|
case static_cast<int>(TuneID::NOTIFY_NEGATIVE):
|
||||||
reset_playing_tune = true;
|
reset_playing_tune = true;
|
||||||
config_tone(false);
|
reset(false);
|
||||||
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
@@ -358,12 +358,12 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration,
|
|||||||
tune_error:
|
tune_error:
|
||||||
// syslog(LOG_ERR, "tune error\n");
|
// syslog(LOG_ERR, "tune error\n");
|
||||||
_repeat = false; // don't loop on error
|
_repeat = false; // don't loop on error
|
||||||
config_tone(_repeat);
|
reset(_repeat);
|
||||||
return TUNE_ERROR;
|
return TUNE_ERROR;
|
||||||
// stop (and potentially restart) the tune
|
// stop (and potentially restart) the tune
|
||||||
tune_end:
|
tune_end:
|
||||||
// restore intial parameter
|
// restore intial parameter
|
||||||
config_tone(_repeat);
|
reset(_repeat);
|
||||||
|
|
||||||
if (_repeat) {
|
if (_repeat) {
|
||||||
return TUNE_CONTINUE;
|
return TUNE_CONTINUE;
|
||||||
|
|||||||
@@ -203,8 +203,10 @@ private:
|
|||||||
unsigned next_dots();
|
unsigned next_dots();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if repeat false set the tune parameters to default else point to the beginning of the tune
|
* Reset the tune parameters. This is necessary when for example a tune moved
|
||||||
|
* one or more octaves up or down. reset() should always be called before
|
||||||
|
* (re)-starting a tune.
|
||||||
*/
|
*/
|
||||||
void config_tone(bool repeat);
|
void reset(bool repeat_flag);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user