tuupola / pico_effects

Old school demo effects for Raspberry Pi Pico
MIT No Attribution
23 stars 5 forks source link

Screen is inverted on st7735 green tab display even with "MIPI_DISPLAY_INVERT" set to zero #10

Closed gamemake-eng closed 1 month ago

gamemake-eng commented 2 months ago

The demo compiled without any errors but, when I flashed the program onto the Pi Pico the screen looked inverted. I tried changing "MIPI_DISPLAY_INVERT" and some other variables in the Cmake file to no avail. I even tried to remove the invert definition but it changed nothing. Everything is also wired up correctly. My config is listed below.

target_compile_definitions(firmware PRIVATE                                                 
    MIPI_DISPLAY_PIN_CS=17                                                                  
    MIPI_DISPLAY_PIN_DC=20                                                                  
    MIPI_DISPLAY_PIN_RST=21                                                                 
    MIPI_DISPLAY_PIN_BL=13                                                                  
    MIPI_DISPLAY_PIN_CLK=18                                                                 
    MIPI_DISPLAY_PIN_MOSI=19                                                                
    MIPI_DISPLAY_PIN_MISO=-1                                                                
    MIPI_DISPLAY_PIN_POWER=-1                                                               
    MIPI_DISPLAY_PIN_VSYNC=-1                                                               

    MIPI_DISPLAY_SPI_PORT=spi0                                                              
    MIPI_DISPLAY_SPI_CLOCK_SPEED_HZ=68000000                                                

    MIPI_DISPLAY_PIXEL_FORMAT=MIPI_DCS_PIXEL_FORMAT_16BIT                                   
    MIPI_DISPLAY_ADDRESS_MODE=MIPI_DCS_ADDRESS_MODE_BGR                                     

    MIPI_DISPLAY_WIDTH=128                                                                  
    MIPI_DISPLAY_HEIGHT=160                                                                 
    MIPI_DISPLAY_OFFSET_X=2                                                                 
    MIPI_DISPLAY_OFFSET_Y=1                                                                 

    MIPI_DISPLAY_INVERT=0                                                                   
)      
gamemake-eng commented 2 months ago

image

Here is also a photo of my problem if that helps

tuupola commented 2 months ago

It does look like wrong MIPI_DISPLAY_INVERT setting. But if you already tried changing that, you could try using MIPI_DCS_ADDRESS_MODE_RGB instead of MIPI_DCS_ADDRESS_MODE_BGR.

tuupola commented 2 months ago

You probably already saw this? I used these settings with some generic ST7735 display from AliExpress.

https://github.com/tuupola/hagl_pico_mipi/blob/master/cmake/generic-st7735-128x128.cmake

gamemake-eng commented 2 months ago

It does look like wrong MIPI_DISPLAY_INVERT setting. But if you already tried changing that, you could try using MIPI_DCS_ADDRESS_MODE_RGB instead of MIPI_DCS_ADDRESS_MODE_BGR.

I also tried that but it didn't work.

gamemake-eng commented 2 months ago

The only thing that worked was going into the display driver code and adding a line bellow the original invert code inside the init function to turn off the invert filter. The original code seems to be checking if MIPI_DISPLAY_INVERT is defined so maybe it's being defined somewhere else.

tuupola commented 2 months ago

Just to make sure, did you actually try to use MIPI_DISPLAY_INVERT=1 in the settings?

gamemake-eng commented 2 months ago

Just to make sure, did you actually try to use MIPI_DISPLAY_INVERT=1 in the settings?

Yes I did. And as I said before, it did not work.

tuupola commented 2 months ago

Now I see it. Not sure what I was thinking. The MIPI_DISPLAY_INVERT is ignored in the code. Thanks for the heads up!

gamemake-eng commented 2 months ago

Now I see it. Not sure what I was thinking. The MIPI_DISPLAY_INVERT is ignored in the code. Thanks for the heads up!

That is what I was suspecting as well. I was planning to make a PR to attempt to fix it since the solution seemed simple.

tuupola commented 1 month ago

Fixed in upstream and synced the HAL to latest version in here. Inversion logic works now. Thanks for the heads up!

gamemake-eng commented 1 month ago

Fixed in upstream and synced the HAL to latest version in here. Inversion logic works now. Thanks for the heads up!

You're welcome :-)