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:
Martina 2017-07-12 18:04:47 +02:00 committed by Daniel Agar
parent 9611641bb7
commit 2ec5ea48a3

View File

@ -94,6 +94,7 @@ int Tunes::set_control(const tune_control_s &tune_control)
case tune_control_s::TUNE_ID_CUSTOM:
_frequency = (unsigned)tune_control.frequency;
_duration = (unsigned)tune_control.duration;
_silence = (unsigned)tune_control.silence;
_using_custom_msg = true;
break;
@ -151,7 +152,7 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &sile
_using_custom_msg = false;
frequency = _frequency;
duration = _duration;
silence = 0;
silence = _silence;
return TUNE_STOP;
}
@ -169,6 +170,7 @@ int Tunes::get_next_tune(unsigned &frequency, unsigned &duration, unsigned &sile
int c = next_char();
if (c == 0) {
silence = 0;
goto tune_end;
}