nspsck / RM67162_Micropython_QSPI

This is a C driver as a user module for the T-AMOLED-S3 using QSPI-protocol.
MIT License
7 stars 4 forks source link

rect_fill issue on larger rectangle #7

Closed dobodu closed 6 months ago

dobodu commented 6 months ago

Trying

display.rect(0, 0, 20, 20, Rd_color) = OK display.rect(0, 0, 100, 100, Gr_color) = OK

but for larger one

display.rect(0, 0, 200, 200, Bl_color) = Truncated in height (I think about 32 pix height) display.rect(0, 0, 240, 240, Rd_color) = the same

I think this is comming from the fill_buffer C function

nspsck commented 6 months ago

IMG_20240503_221301.jpg

IMG_20240503_221153.jpg

So the code I ran was something like:

tft = tft_config.config()
    tft.reset()
    tft.init()
    tft.rotation(0)
    tft.rect(0,0,20,20,tft.colorRGB(255,0,0))
    tft.rect(0,0,100,100,tft.colorRGB(255,255,0))
    tft.rect(0,0,200,200,tft.colorRGB(255,255,0))
# for the one above
    tft.rect(0,0,239,240,tft.colorRGB(255,255,0))
#and for the one below
    tft.rect(0,0,240,240,tft.colorRGB(255,255,0))

The coordinates start at 0 but it only has 240 pixels in width/height, which means, the valid inputs should be in the range of [0, 239].

However, there is indeed a not-so-uniform range for rect(start_x, start_y, rect_width, rect_height) and fill_rect(start_x, start_y, rect_width, rect_height), and that should be indeed changed. Depending on how you view the problem, one can argue whether to count the first pixel into width or not. I am going to make this uniform now the first pixel will be count into width and height.

Truncated in height (I think about 32 pix height)

Could you please add some pictures for me to actually have a view on that problem? I failed to reproduce the issue. (even measured with a ruler, lol)

dobodu commented 6 months ago

That's right... I must have made a mistake... The code I was trying was

display.fill_rect(0, 0, 20, 20, Bl_color)
sleep_ms(1000)
display.fill_rect(0, 0, 100, 100, Rd_color)
sleep_ms(1000)
display.fill_rect(0, 0, 200, 200, Bl_color)
sleep_ms(1000)
display.fill_rect(0, 0, 400, 240, Rd_color)
sleep_ms(1000)

But as I rebooted all the system now, it doesn't show wht I thought to be a bug... Maybe doing too many things at the sime time in my code...

Sorry for disturbing !

nspsck commented 6 months ago

That's fine! Thank you for testing the code out!