I am also stumped on changing the screen orientation.
I commented out the conditional statements and tried each of the four options one at a time and it did not make any change whatsoever.
I question whether the line
sendCommand(0x03);
is correct, since all of the other commands in the library have four-digit commands. I tried replacing it with 0x0003 with no effect though.
I took a look at the data sheet for the ST7781R (orientation is on page 93), but my kung fu is not strong enough to really decipher it.
It looks like the command, data, and write values in the library make sense though:
Entry Mode (R03h)
RS WRX RDX D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
1 ↑ 1 TRI DFM 0 BGR 0 0 HWM 0 ORG 0 I/D1 I/D0 AM 0 0 0
Default value 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0
AM: Sets the DRAM Update Direction
When AM = “0”, set the horizontal writing direction.
When AM = “1”, set the vertical writing direction.
When a window area is set by registers R50h ~R53h, only the addressed DRAM area is updated based
on I/D [1:0] and AM bits setting.
The difference between the 0x1030 and 0x1038 (orientation values in the library) in binary is that 4th bit (which is AM). But the TFT.init() function seems to set it to 1030, which strikes me that it should be horizontal by default. My display comes up in vertical by default.
I have no idea if I am reading any of this correctly. Does any of it make any sense?
Is there a way to confirm that the display driver is actually an ST7781R?