Revert "Update xdrv_16_tuyadimmer.ino"

This reverts commit 7b71331cf67ccbf7092f88491dc1f998841d274c.
This commit is contained in:
thirug010 2019-05-19 09:46:44 -05:00
parent 7b71331cf6
commit 27dd98c539

View File

@ -123,12 +123,23 @@ 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, bitRead(rpower, deviceid-1));
TuyaSendBool(deviceid, TuyaGetPower(rpower, deviceid));
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]);