mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
Rename Tunes::get_next_tune() to Tunes::get_next_note().
This commit is contained in:
@@ -98,7 +98,7 @@ void ToneAlarm::next_note()
|
|||||||
_silence_length = 0;
|
_silence_length = 0;
|
||||||
|
|
||||||
} else if (_play_tone) {
|
} else if (_play_tone) {
|
||||||
int parse_ret_val = _tunes.get_next_tune(frequency, duration, _silence_length);
|
int parse_ret_val = _tunes.get_next_note(frequency, duration, _silence_length);
|
||||||
|
|
||||||
if (parse_ret_val > 0) {
|
if (parse_ret_val > 0) {
|
||||||
// Continue playing.
|
// Continue playing.
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ void Tunes::set_string(const char *const string, uint8_t strength)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tunes::get_next_tune(unsigned &frequency, unsigned &duration,
|
int Tunes::get_next_note(unsigned &frequency, unsigned &duration,
|
||||||
unsigned &silence, uint8_t &strength)
|
unsigned &silence, uint8_t &strength)
|
||||||
{
|
{
|
||||||
int ret = get_next_tune(frequency, duration, silence);
|
int ret = get_next_note(frequency, duration, silence);
|
||||||
|
|
||||||
// Check if note should not be heard -> adjust strength to 0 to be safe.
|
// Check if note should not be heard -> adjust strength to 0 to be safe.
|
||||||
if (frequency == 0 || duration == 0) {
|
if (frequency == 0 || duration == 0) {
|
||||||
@@ -163,7 +163,7 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tunes::get_next_tune(unsigned &frequency, unsigned &duration,
|
int Tunes::get_next_note(unsigned &frequency, unsigned &duration,
|
||||||
unsigned &silence)
|
unsigned &silence)
|
||||||
{
|
{
|
||||||
// Return the values for frequency and duration if the custom msg was received.
|
// Return the values for frequency and duration if the custom msg was received.
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
* @param silence return silence duration (us)
|
* @param silence return silence duration (us)
|
||||||
* @return -1 for error, 0 for play one tone and 1 for continue a sequence
|
* @return -1 for error, 0 for play one tone and 1 for continue a sequence
|
||||||
*/
|
*/
|
||||||
int get_next_tune(unsigned &frequency, unsigned &duration, unsigned &silence);
|
int get_next_note(unsigned &frequency, unsigned &duration, unsigned &silence);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get next note in the current tune, which has been provided by either
|
* Get next note in the current tune, which has been provided by either
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
* @param strength return the strength of the note (between 0-100)
|
* @param strength return the strength of the note (between 0-100)
|
||||||
* @return -1 for error, 0 for play one tone and 1 for continue a sequence
|
* @return -1 for error, 0 for play one tone and 1 for continue a sequence
|
||||||
*/
|
*/
|
||||||
int get_next_tune(unsigned &frequency, unsigned &duration,
|
int get_next_note(unsigned &frequency, unsigned &duration,
|
||||||
unsigned &silence, uint8_t &strength);
|
unsigned &silence, uint8_t &strength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ tune_control_main(int argc, char *argv[])
|
|||||||
PX4_INFO("Start playback...");
|
PX4_INFO("Start playback...");
|
||||||
tunes.set_string(tune_string, tune_control.strength);
|
tunes.set_string(tune_string, tune_control.strength);
|
||||||
|
|
||||||
while (tunes.get_next_tune(frequency, duration, silence, strength) > 0) {
|
while (tunes.get_next_note(frequency, duration, silence, strength) > 0) {
|
||||||
tune_control.tune_id = 0;
|
tune_control.tune_id = 0;
|
||||||
tune_control.frequency = (uint16_t)frequency;
|
tune_control.frequency = (uint16_t)frequency;
|
||||||
tune_control.duration = (uint32_t)duration;
|
tune_control.duration = (uint32_t)duration;
|
||||||
@@ -236,7 +236,7 @@ tune_control_main(int argc, char *argv[])
|
|||||||
PX4_WARN("Tune ID not recognized.");
|
PX4_WARN("Tune ID not recognized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tunes.get_next_tune(frequency, duration, silence, strength) > 0) {
|
while (tunes.get_next_note(frequency, duration, silence, strength) > 0) {
|
||||||
PX4_INFO("frequency: %d, duration %d, silence %d, strength%d",
|
PX4_INFO("frequency: %d, duration %d, silence %d, strength%d",
|
||||||
frequency, duration, silence, strength);
|
frequency, duration, silence, strength);
|
||||||
px4_usleep(500000);
|
px4_usleep(500000);
|
||||||
|
|||||||
Reference in New Issue
Block a user