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.
This commit is contained in:
Alessandro Simovic
2018-03-26 14:54:23 +02:00
committed by Beat Küng
parent 34836a2b21
commit d455c1e7e1
+9 -1
View File
@@ -88,7 +88,15 @@ void Tunes::config_tone(bool repeat_flag)
int Tunes::set_control(const tune_control_s &tune_control)
{
bool reset_playing_tune = false;
_repeat = false;
// Only reset these flags if the new tune will actually be played.
// Note that repeated tunes can always be interrupted, even without the
// override flag.
if (_repeat || _tune == nullptr || tune_control.tune_override) {
_repeat = false;
_using_custom_msg = false;
_tune = nullptr;
}
if (tune_control.tune_id < _default_tunes_size) {
switch (tune_control.tune_id) {