From cf2891f9b9709e488237069032c781fa66a4cf73 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 27 Aug 2021 16:39:18 +0200 Subject: [PATCH] Add Sonoff L1 MusicSync off when a color change is requested Add Sonoff L1 MusicSync off when a color change is requested (#12930) --- tasmota/xlgt_05_sonoff_l1.ino | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tasmota/xlgt_05_sonoff_l1.ino b/tasmota/xlgt_05_sonoff_l1.ino index b8b246b70..6be1205f2 100644 --- a/tasmota/xlgt_05_sonoff_l1.ino +++ b/tasmota/xlgt_05_sonoff_l1.ino @@ -286,6 +286,16 @@ bool SnfL1SetChannels(void) { return true; } +bool SnfL1SetChannelsFromFunc(void) { + static bool first_call = true; + if (first_call) { + first_call = false; // Allow MusicSync at init time + } else { + Settings->sbflag1.sonoff_l1_music_sync = 0; // Disable MusicSync on user color change + } + return SnfL1SetChannels(); +} + bool SnfL1ModuleSelected(void) { if (SONOFF_L1 == TasmotaGlobal.module_type) { if (PinUsed(GPIO_RXD) && PinUsed(GPIO_TXD)) { @@ -345,7 +355,7 @@ bool Xlgt05(uint8_t function) result = SnfL1SerialInput(); break; case FUNC_SET_CHANNELS: - result = SnfL1SetChannels(); + result = SnfL1SetChannelsFromFunc(); break; case FUNC_MODULE_INIT: result = SnfL1ModuleSelected();