-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added brightness for oled display ssd1306 #681
Conversation
Would love to see this go through, could you possibly fix the linting error so it passes the gates? |
@waiet thanks for contributing, can you check the build check failure of Travis and fix your code so it is happy to merge? |
@@ -29,6 +29,8 @@ class SSD1306 : public PollingComponent, public display::DisplayBuffer { | |||
void set_model(SSD1306Model model) { this->model_ = model; } | |||
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; } | |||
void set_external_vcc(bool external_vcc) { this->external_vcc_ = external_vcc; } | |||
void set_brightness_(float brightness) { this->brightness_ = brightness; } | |||
// void set_brightness_(optional<float> brightness) { this->brightness_ = brightness; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code please.
@@ -100,7 +97,7 @@ void SSD1306::setup() { | |||
this->command(0xF1); | |||
|
|||
this->command(SSD1306_COMMAND_SET_VCOM_DETECT); | |||
this->command(0x40); | |||
this->command(0x00); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change for? Is it required for different brightness settings? Will this prevent some brightness settings from working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an SSD1306 128x64, with this change the lowest brightness are more lower, in any case 0% is visible. Kind of works.
else | ||
this->command(0xCF); | ||
break; | ||
this->command(int(255 * (this->brightness_))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix the lint error, dedent this and the next line by 2 spaces.
@glment you got this? Would really like to see this implemented, if your not up to the corrections I can take over. |
Added brightness controll for oled display ssd_1306.
Tested with i2c ssd1306 1.3" and spi ssd1306 2.42"