From ffbd1af0d18aef2bfa50f1fe34c4a480d8638802 Mon Sep 17 00:00:00 2001 From: thirug010 <30732819+thirug010@users.noreply.github.com> Date: Sun, 19 May 2019 09:47:51 -0500 Subject: [PATCH] Revert "Revert "Update xdrv_16_tuyadimmer.ino"" This reverts commit 27dd98c539f8603acc9a3102918ece348f32d642. --- sonoff/xdrv_16_tuyadimmer.ino | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sonoff/xdrv_16_tuyadimmer.ino b/sonoff/xdrv_16_tuyadimmer.ino index 4b0ebfcd8..202674ac5 100644 --- a/sonoff/xdrv_16_tuyadimmer.ino +++ b/sonoff/xdrv_16_tuyadimmer.ino @@ -123,23 +123,12 @@ bool TuyaSetPower(void) int16_t source = XdrvMailbox.payload; if (source != SRC_SWITCH && TuyaSerial) { // ignore to prevent loop from pushing state from faceplate interaction - TuyaSendBool(deviceid, TuyaGetPower(rpower, deviceid)); + TuyaSendBool(deviceid, bitRead(rpower, deviceid-1)); status = true; } return status; } -uint8_t TuyaGetPower(uint8_t p, uint8_t d) { - uint8_t g = 0; - for(int i = 7 ; i >= 0 ; i--) { - g = p >> i; - //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: --SetDevicePower3-- for Device = %d, Power=%d"),i, k&1); - if (i== d-1) - { - return g&1; - } - } -} bool TuyaSetChannels(void) { LightSerialDuty(((uint8_t*)XdrvMailbox.data)[0]);