Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 5 months ago.
Bug: Display is updated only every 2nd update() call.
The sample code shows only every 2nd value of x.
Calling display() consecutive two times, every value of x is displayed.
Is this a (known) bug?
I2CPreInit gI2C(p9,p10); Adafruit_SSD1306_I2c gOled2(gI2C,p27); int main() { uint16_t x=0; gOled2.printf("%ux%u OLED Display\r\n", gOled2.width(), gOled2.height()); while(1) { myled = !myled; gOled2.printf("%u\r",x); gOled2.display(); x++; wait(1.0); } }
Question relating to:
1 Answer
8 years, 2 months ago.
Hello, Tobias. I have same problem and fix it. if you use only 128x32 oled , then change below at line 206 in Adafruit_SSD1306.h
Adafruit_SSD1306.h
for(uint16_t i=0, q=buffer.size(); i<q; i+=16 )
to change
Adafruit_SSD1306.h
for(uint16_t i=0 ; i<1024; i+=16 )
I cannot understand why this fix work fine. std::vector works well, and the member size() also works well.
if you use 128x64 oled, change 1024 to 2048.
This bug is probably due to casting issues with the return type of buffer.size(). To be type-safe, change the snippet into:
Adafruit_SSD1306.h @ 206
for(std::vector<uint8_t>::size_type i=0, q=buffer.size(); i<q; i+=16 ) { std::vector<uint8_t>::size_type x ;
This way, no hardcoding of the display size is required.
posted by 17 Jan 2017