mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 21:33:33 +08:00
tunes: for custom tunes set silence from tune control message and set
silence to 0 when the end of the string is reached
This commit is contained in:
@@ -94,6 +94,7 @@ int Tunes::set_control(const tune_control_s &tune_control)
|
|||||||
case tune_control_s::TUNE_ID_CUSTOM:
|
case tune_control_s::TUNE_ID_CUSTOM:
|
||||||
_frequency = (unsigned)tune_control.frequency;
|
_frequency = (unsigned)tune_control.frequency;
|
||||||
_duration = (unsigned)tune_control.duration;
|
_duration = (unsigned)tune_control.duration;
|
||||||
|
_silence = (unsigned)tune_control.silence;
|
||||||
_using_custom_msg = true;
|
_using_custom_msg = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -151,7 +152,7 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &sile
|
|||||||
_using_custom_msg = false;
|
_using_custom_msg = false;
|
||||||
frequency = _frequency;
|
frequency = _frequency;
|
||||||
duration = _duration;
|
duration = _duration;
|
||||||
silence = 0;
|
silence = _silence;
|
||||||
return TUNE_STOP;
|
return TUNE_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +170,7 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &sile
|
|||||||
int c = next_char();
|
int c = next_char();
|
||||||
|
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
|
silence = 0;
|
||||||
goto tune_end;
|
goto tune_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user