mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
[ssd1351] fix: wait for the component to be at least in setup phase b… (#5454)
This commit is contained in:
parent
2c94c3d96f
commit
d3913be7e5
1 changed files with 3 additions and 0 deletions
|
@ -112,6 +112,9 @@ void SSD1351::set_brightness(float brightness) {
|
||||||
} else {
|
} else {
|
||||||
this->brightness_ = brightness;
|
this->brightness_ = brightness;
|
||||||
}
|
}
|
||||||
|
if (!this->is_ready()) {
|
||||||
|
return; // Component is not yet setup skip the command
|
||||||
|
}
|
||||||
// now write the new brightness level to the display
|
// now write the new brightness level to the display
|
||||||
this->command(SSD1351_CONTRASTMASTER);
|
this->command(SSD1351_CONTRASTMASTER);
|
||||||
this->data(int(SSD1351_MAX_CONTRAST * (this->brightness_)));
|
this->data(int(SSD1351_MAX_CONTRAST * (this->brightness_)));
|
||||||
|
|
Loading…
Reference in a new issue