mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-26 15:48:28 +02:00
Introduce clamp as a template function (#1953)
This commit is contained in:
@@ -130,7 +130,7 @@ void SSD1306::update() {
|
||||
}
|
||||
void SSD1306::set_brightness(float brightness) {
|
||||
// validation
|
||||
this->brightness_ = clamp(brightness, 0, 1);
|
||||
this->brightness_ = clamp(brightness, 0.0F, 1.0F);
|
||||
// now write the new brightness level to the display
|
||||
this->command(SSD1306_COMMAND_SET_CONTRAST);
|
||||
this->command(int(SSD1306_MAX_CONTRAST * (this->brightness_)));
|
||||
|
||||
Reference in New Issue
Block a user