nathanielxd / magic-home

A .NET library that imports functionality from the Magic Home app, allowing control of smart lights.
GNU General Public License v3.0
27 stars 7 forks source link

Lights flickering #7

Open icky7s opened 4 years ago

icky7s commented 4 years ago

I noticed my lights flicker/flash to white before setting the color. I'm wondering if this is an issue with my lights or something else? Code that causes issues:

await lights.setColorAsync(255, 0, 0); // all colors cause flashes
icky7s commented 4 years ago

I fixed the flickering by modifying the SetColorAsync method, changed

if (Protocol == LedProtocol.LEDENET) 
    await SendDataAsync(0x41, color.Red, color.Green, color.Blue, 0x00, 0x00, 0x0f);
else
    await SendDataAsync(0x56, color.Red, color.Green, color.Blue, 0xaa);

to

await SendDataAsync(0x31, color.Red, color.Green, color.Blue, 0x00, 0x00, 0x0f); // stolen from a nodejs module that didn't cause flickering
nathanielxd commented 4 years ago

Hello! Can you tell me what kind of led strip are you using so I can fix this problem? Thanks.

icky7s commented 4 years ago

I am using these https://www.amazon.com/gp/product/B07HD1CS45