Hello everyone! First time here, apologies in advance for the verbosity. I did search around the forum here and while I did find some useful information I am still a little stuck on something.
So, first off I am messing with a 3.97 inch microyum TFT display, returning ID=0x7793, and am using MCUFRIEND_kbv. When running some example sketches I noticed when scrolling and when using reverse orientation that there seems to be a strip of 32px of static, and also reverse orientations are seemingly offset by this such that the screen is outside the display boundaries.
I looked at the setRotation function in the MCUFRIEND_kbv class, and on line 461 I changed NL = ((432 / 8) - 1) << 9; to NL = ((400 / 8) - 1) << 9; and reverse orientations are where they should be. I'm not really sure what this line actually does, though as I'm not really certain where WriteCmdData is writing to or what it it is writing later on line 463. I can see it calls WriteCmd and WriteData, and those are defined to write16(). But I don't know what 0x400, GS, and NL are supposed to represent here. I'm assuming that 0x400 is the memory address and GS | NL is flagging something true or false, but that's all I could figure in the few hours I was messing with it.
The static was still present though, and I noticed after running calibrate and then switching back to graphictest without a full power down, I noticed that the static actually seemed to be old/junk memory, as whatever was on the screen in the previous sketch would be the noise area. However from a fresh start it's just static.
So at first I tried changing *p16 = 400 to 432 and while this did get rid of the noise it screwed up everything else such that now the screen is too long for the display and the coordinates became skewed, which I think is because p16 is assigned the address of HEIGHT from Adafruit_GFX.h, the raw height of the display, and then *p16 changes that value... Right?
Thinking a little more on it now, the noise might have something to do with the readGRAM function? That doesn't really make sense to me though, but considering that what's in that space seems to be junk it doesn't actually look like it's setting aside more screen than there is display.
Could anyone weigh in on what the first change actually did, and what could be causing the junk? I feel like I am missing something really obvious. I suppose I don't see myself really needing to scroll if I didn't have a screen area larger than the display, and I assume that vertical scroll is for such instances. This actually makes me wonder if it's an issue with the coordinates? If I were to increase *p16 and then figure out how to get the coordinates to correspond with display size vs screen area for calibrate or anything that centers things. Is there a distinction between display size and screen area?
Thank you!
mkylman