Hi,
I have a problem with alignment of a label. If I set a text for the first time it is drawn correctly on the display. When I align the label e.g. to the right top corner, it is aligned correctly as well. But the problem occures when I want to change the aligned text later. If I rewrite the text then it spills (the characters go to pieces) and the text is no more readable. When I rewrite the text again I can see some changes but the text remains spilled. However, if I don´t align the text it is always rewritten correctly and is always readable.
What I want to reach is just to create a text, align it and later when an event is received I want to rewrite this text.
Well, I realized that I don’t need to test it on the simulator. I have read the data which are sent in the Display_flush_cb callback to the display driver. And all data are correct. That means the display driver renders the data correctly on the display. So either there is a bug in the lv_obj_align function or there is something wrong in my library initialization. I suppose the bug is on my side
And there two interesting things. If I align the label to LV_ALIGN_IN_TOP_LEFT then everything is OK and I can rewrite the text later. But any other align position fails. And if I change the size of the buffer to e.g. 128 x 8 the display shows nothing - remains empty.
It looks like a driver issue. I suggest using you driver without LittlevGL to set only one pixel on the screen and see if really to correct pixel is set or not.
Hi, I tried to set one pixel without using the LvGL and the driver displays it exactly on the position. Code is here (together with description of the ssd driver function). Note that the pixel is shown on position (10,0).
void Test_DrawPixel (void)
{
uint8_t Buffer[1] = {0x01};
ssd1306_drawBuffer (10, 0, 1, 8, Buffer);
/**
* Draws bitmap, located in SRAM, on the display
* Each byte represents 8 vertical pixels.
*
* ~~~~~~~~~~~~~~~{.c}
* // Draw small rectangle 3x8 at position 10,8
* uint8_t buffer[3] = { 0xFF, 0x81, 0xFF };
* ssd1306_drawBuffer(10, 1, 3, 8, buffer);
* ~~~~~~~~~~~~~~~
*
* @param x - horizontal position in pixels
* @param y - vertical position in blocks (pixels/8)
* @param w - width of bitmap in pixels
* @param h - height of bitmap in pixels (must be divided by 8)
* @param buf - pointer to data, located in SRAM: each byte represents 8 vertical pixels.
void ssd1306_drawBuffer(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf);
*/
}
Hi,
so finally I have found the bug. I have found it during preparing the data for you. I noticed that the problem is really in the Display_Flush_cb callback. The width must be u8_Width = area->x2 - area->x1 +1;. When the label was aligned to the left, everything was ok. But when x1 was greater than 0 the problem occured. And my second problem with changing the buffer size is also resolved: the y1 coordinate must be as following: u8_BlockHeight = area->y1/8;
So I would like to apologize you for losing your time and thank you for your support. Please consider this issue as closed.