add fix for gamma control on IL9486 boards #3266
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've got this board: http://www.lcdwiki.com/4.0inch_SPI_Module_ILI9486 and have noticed issues with what appears to be the gamma correction set by default in the ILI9486 driver.
When you use this board straight out of the box, R/G/B + black/white and the screen itself all display perfectly fine. It is only when you go into the gradients and shades of colours that you notice they are not correct.
My test code was along the lines of this loop:
` tft.fillScreen(0x8630); // 34352
tft.setTextSize(1);
tft.setTextFont(1);
int r=0,g=0,b=0;
while (!killSwitch) {
tft.setCursor(5, 5);
tft.printf("r=%d,g=%d,b=%d",r,g,b);
tft.fillRect(100, 100, 300, 200, ((r << 11) | (g << 5) | b));
g++;
if (g > 63) { r++; b++; g = r; }
if (r > 63) { r = 0; b = 0; }
delay(100);
}`
The datasheet for the chip: https://www.hpinfotech.ro/ILI9486.pdf which explains the E0 / E1 gamma control function.
As per this discussion: #3018, commenting out the gamma control commands makes my screen work perfectly.
I would suggest as per this pull request if ILI9486_Init.h could take in config from User_Setup.h to make this control more explicit and probably save users time debugging not understanding the gamma control issue. Hope this at least provides visibility on this fix and saves someone in the future a few hours of their day!