Add support for BP5758's sleep mode

This commit is contained in:
oogm 2022-05-29 17:55:48 +02:00
parent cae46e0d01
commit 1aaf186cae

View File

@ -108,6 +108,13 @@ void Bp5758dStop(void) {
bool Bp5758dSetChannels(void) {
uint16_t *cur_col_10 = (uint16_t*)XdrvMailbox.command;
// If we receive 0 for all channels, we'll assume that the lightbulb is off, and activate BP5758d's sleep mode.
if (cur_col_10[0]==0 && cur_col_10[1]==0 && cur_col_10[2]==0 && cur_col_10[3]==0 && cur_col_10[4]==0) {
Bp5758dStart(BP5758D_ADDR_SLEEP);
Bp5758dStop();
return true;
}
// Even though we could address changing channels only, in practice we observed that the lightbulb always sets all channels.
Bp5758dStart(BP5758D_ADDR_OUT1_GL);
// Brigtness values are transmitted as two bytes. The light-bulb accepts a 10-bit integer (0-1023) as an input value.