From 2486d5730af59279ddc693aa795a9ea37905e21c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 16 Dec 2020 14:58:30 +0100 Subject: [PATCH] Refactor SM2135 model detection --- tasmota/xlgt_04_sm2135.ino | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tasmota/xlgt_04_sm2135.ino b/tasmota/xlgt_04_sm2135.ino index dd766ab33..92d1d5059 100644 --- a/tasmota/xlgt_04_sm2135.ino +++ b/tasmota/xlgt_04_sm2135.ino @@ -182,21 +182,12 @@ void Sm2135ModuleSelected(void) Sm2135.clk = Pin(GPIO_SM2135_CLK); Sm2135.data = Pin(GPIO_SM2135_DAT, GPIO_ANY); - Sm2135.model = SM2135_WCGRB; + Sm2135.model = GetPin(Sm2135.data) - AGPIO(GPIO_SM2135_DAT); // 0 .. 3 if (PinUsed(GPIO_SWT1)) { Sm2135.model = SM2135_WCBGR; pinMode(Pin(GPIO_SWT1), INPUT); // Discard GPIO_SWT functionality SetPin(Pin(GPIO_SWT1), AGPIO(GPIO_NONE)); } - if (PinUsed(GPIO_SM2135_DAT, 1)) { - Sm2135.model = SM2135_WCBGR; - } - if (PinUsed(GPIO_SM2135_DAT, 2)) { - Sm2135.model = SM2135_WCGRBHI; - } - if (PinUsed(GPIO_SM2135_DAT, 3)) { - Sm2135.model = SM2135_WCBGRHI; - } // RGB current CW current Sm2135.current = (SM2135_20MA << 4) | SM2135_15MA; // See https://github.com/arendst/Tasmota/issues/6495#issuecomment-549121683