Estylos / EPD_PoC_UGUI

STM32 CubeHAL proof of concept GUI with µGUI for ePaper display
MIT License
2 stars 0 forks source link

Display problem in 2.9 inch #1

Open Foxstails opened 2 months ago

Foxstails commented 2 months ago

hello, I tried this program and I tried changing it to 2.9 inch with the format as below: // RetargetInit(&huart1); // printf epd.spi = &hspi1;

// CubeMX pin and port constants
epd.panelBusy.pin = EPD_BUSY_Pin;
epd.panelBusy.port = EPD_BUSY_GPIO_Port;

epd.panelCS.pin = EPD_CS_Pin;
epd.panelCS.port = EPD_CS_GPIO_Port;

epd.panelDC.pin = EPD_DC_Pin;
epd.panelDC.port = EPD_DC_GPIO_Port;

epd.panelReset.pin = EPD_RST_Pin;
epd.panelReset.port = EPD_RST_GPIO_Port;

// Select the constants for your EPD (from epd_screens.h)
epd.epdType = EPD_DISPLAY_290;
epd.displaySizeH = EPD_DISPLAY_290_SIZE_H;
epd.displaySizeV = EPD_DISPLAY_290_SIZE_V;

epd.epdPSR[0] = EPD_DISPLAY_290_PSR0;
epd.epdPSR[1] = EPD_DISPLAY_290_PSR1;

// Config UGUI device
epdDev.x_dim = epd.displaySizeV;
epdDev.y_dim = epd.displaySizeH;
epdDev.pset = &epd_pset;
epdDev.flush = &epd_flush;

but why doesn't the window adjust to the screen? WhatsApp Image 2024-05-27 at 11 41 10_d6a8e49f

I tried checking in UG_WindowCreate I tried changing changing wnd->xs = 0; becomes wnd->xs = -90; WhatsApp Image 2024-05-27 at 11 40 19_f54deb6b

but the window still doesn't fit the screen. Are there any variables that need to be improved? Thank You

Estylos commented 1 month ago

Hello,

Did you change the size of the bufferOld and bufferNew static buffers (EPD_DISPLAY_266_SIZE_V and EPD_DISPLAY_266_SIZE_H) on lines 60, 61 and lines 214, 218 of main.c to the correct screen size?

Have a nice day!

Foxstails commented 1 month ago

this works, is an example to change from landscape to portrait? Thank you

Estylos commented 1 month ago

Hello,

I don't have an example for a portrait image display, but you'll probably need to invert the values of epdDev.x_dim and epdDev.y_dim. Possibly there are changes to be made in the epd_pset function in order to fill the buffer “correctly”, knowing that the origin of the screen in this code is taken in the upper left corner (looking at the screen with its connector to the left).

image For information, here's how a frame is represented in the buffer for display on the screen. The buffers of the fastUpdateDisplay function respect this setting.