mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
Sleep mode fix for BP5758D driver (#5461)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
85c5928baa
commit
f709350b04
1 changed files with 6 additions and 2 deletions
|
@ -39,10 +39,14 @@ void BP5758D::loop() {
|
||||||
uint8_t data[17];
|
uint8_t data[17];
|
||||||
if (this->pwm_amounts_[0] == 0 && this->pwm_amounts_[1] == 0 && this->pwm_amounts_[2] == 0 &&
|
if (this->pwm_amounts_[0] == 0 && this->pwm_amounts_[1] == 0 && this->pwm_amounts_[2] == 0 &&
|
||||||
this->pwm_amounts_[3] == 0 && this->pwm_amounts_[4] == 0) {
|
this->pwm_amounts_[3] == 0 && this->pwm_amounts_[4] == 0) {
|
||||||
// Off / Sleep
|
|
||||||
data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_STANDBY;
|
|
||||||
for (int i = 1; i < 16; i++)
|
for (int i = 1; i < 16; i++)
|
||||||
data[i] = 0;
|
data[i] = 0;
|
||||||
|
|
||||||
|
// First turn all channels off
|
||||||
|
data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_START_3CH;
|
||||||
|
this->write_buffer_(data, 17);
|
||||||
|
// Then sleep
|
||||||
|
data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_STANDBY;
|
||||||
this->write_buffer_(data, 17);
|
this->write_buffer_(data, 17);
|
||||||
} else if (this->pwm_amounts_[0] == 0 && this->pwm_amounts_[1] == 0 && this->pwm_amounts_[2] == 0 &&
|
} else if (this->pwm_amounts_[0] == 0 && this->pwm_amounts_[1] == 0 && this->pwm_amounts_[2] == 0 &&
|
||||||
(this->pwm_amounts_[3] > 0 || this->pwm_amounts_[4] > 0)) {
|
(this->pwm_amounts_[3] > 0 || this->pwm_amounts_[4] > 0)) {
|
||||||
|
|
Loading…
Reference in a new issue