1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 03:12:20 +01:00

[ssd1351] fix: wait for the component to be at least in setup phase b… (#5454)

This commit is contained in:
De Cock Xavier
2023-09-30 00:08:56 +02:00
committed by GitHub
parent 2c94c3d96f
commit d3913be7e5

View File

@@ -112,6 +112,9 @@ void SSD1351::set_brightness(float brightness) {
} else {
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
this->command(SSD1351_CONTRASTMASTER);
this->data(int(SSD1351_MAX_CONTRAST * (this->brightness_)));