Disable auto-playlist if manual selection is made
This commit is contained in:
@@ -12,6 +12,7 @@ class AutoPlaylistUsermod : public Usermod {
|
|||||||
byte musicPlaylist = 2;
|
byte musicPlaylist = 2;
|
||||||
int timeout = 60;
|
int timeout = 60;
|
||||||
bool autoChange = false;
|
bool autoChange = false;
|
||||||
|
byte lastAutoPreset = 0;
|
||||||
|
|
||||||
|
|
||||||
int avg_long_energy = 10000;
|
int avg_long_energy = 10000;
|
||||||
@@ -136,6 +137,8 @@ class AutoPlaylistUsermod : public Usermod {
|
|||||||
|
|
||||||
if(bri == 0) return;
|
if(bri == 0) return;
|
||||||
|
|
||||||
|
if(lastAutoPreset > 0 && lastAutoPreset != currentPreset) enabled = false;
|
||||||
|
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// No Audio Reactive
|
// No Audio Reactive
|
||||||
@@ -156,6 +159,7 @@ class AutoPlaylistUsermod : public Usermod {
|
|||||||
getPresetName(ambientPlaylist, name);
|
getPresetName(ambientPlaylist, name);
|
||||||
USER_PRINTF("AutoPlaylist: Silence - apply %s\n", name.c_str());
|
USER_PRINTF("AutoPlaylist: Silence - apply %s\n", name.c_str());
|
||||||
applyPreset(ambientPlaylist, CALL_MODE_NOTIFICATION);
|
applyPreset(ambientPlaylist, CALL_MODE_NOTIFICATION);
|
||||||
|
lastAutoPreset = ambientPlaylist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -165,6 +169,7 @@ class AutoPlaylistUsermod : public Usermod {
|
|||||||
getPresetName(musicPlaylist, name);
|
getPresetName(musicPlaylist, name);
|
||||||
USER_PRINTF("AutoPlaylist: End of silence - apply %s\n", name.c_str());
|
USER_PRINTF("AutoPlaylist: End of silence - apply %s\n", name.c_str());
|
||||||
applyPreset(musicPlaylist, CALL_MODE_NOTIFICATION);
|
applyPreset(musicPlaylist, CALL_MODE_NOTIFICATION);
|
||||||
|
lastAutoPreset = ambientPlaylist;
|
||||||
}
|
}
|
||||||
if(autoChange) change(um_data);
|
if(autoChange) change(um_data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user