Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:47 05 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : ili9341: magenta is the new grey

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 07:41am 29 May 2015
Copy link to clipboard 
Print this post

I've been playing trying to plot some anti-aliased lines to make a better meter display when I came across the following issue (probably applies to the other displays but I haven't had chance to test them):

The display on the ili9341 has a 16 bit colour code - RGB565. This means that there are 5-bits defining the red level (32 different values), 6-bits for green (64 different values) and 5-bits for blue.

Geoff's code in 4.7b8 packs a 24-bit number into the RGB format by dividing red by 8, green by 4 and blue by 8 and then positioning the bits correctly in a 16-bit integer.
You would assume therefore that rgb(250,250,250) would give a light grey colour. Unfortunately it doesn't - try running the code below (the display must be in landscape mode). The workround is to add 1 increment to the green intensity.


option explicit
option default none
cls rgb(white)
dim integer i
for i=0 to 255 step 1
line i,0,i,239,4,rgb(i,i,i)
next i
line 256,0,256,239,,0
print "This is strange!"
pause 4000
for i=0 to 255 step 1
line i,0,i,239,4,rgb(i,min(i+4,255),i)
next i
line 256,0,256,239,,0
print "This is better"
end
'
function min(a as integer, b as integer) as integer
if a<b then
min=a
else
min=b
endif
end function
Edited by matherp 2015-05-30
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 11:06am 29 May 2015
Copy link to clipboard 
Print this post

Do you think this applies to the ST7735 also?
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:40am 30 May 2015
Copy link to clipboard 
Print this post

I have been checking the code and there may be a bug which is causing this. I will investigate further.

Yes, this bug would also affect the ST7735.


Geoff Graham - http://geoffg.net
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024