Closed helinick81 closed 6 years ago
The code draws the data on a 320x240 grid in landscape and if the screen driver is working correctly when switched to landscape I’d expect it to occupy 320/480 of the width and 240/320 of the height, so in width there would still be 160 pixels free and in height 80 pixels free. If it works ok in portrait and when switched to landscape and the display size is wrong then this is a display driver error when it switches to landscape. Try drawing a character in the programme to say 470,310 it should be in the bottom left of the screen if the driver is working correctly. Romberg each drawing statement in the programme would need to be scaled to work with the larger screen. Also font sizes play a large role, so have you been able to set the correct sizes. This is not really a code issue just comestic, but I’d check your screen driver.
Thanks for reply its as you say it if i understand correctly
i have taken some pics to help explain my issue.
Below is my code from the setup section
its the tft.setRotation(1) that i change from 0 to 1 to change landscape or portrait.
`void setup() { Serial.begin(115200); tft.begin(); tft.setRotation(1); clear_screen(); display_progress("Connecting to Network", 50); WiFi.begin(ssid, password); delay(5000); Serial.println("Connected to : " + WiFi.SSID()); // Report which SSID has been used Serial.print("IP address : "); Serial.println(WiFi.localIP()); // And the IP address assigned display_status(); }
Thanks for the photo I can see now it is working correctly in landscape mode and all that’s happening is the drawing is scaled down.
You will need to scale each drawstring command and line drawing command by a factor of 480/320 and 320/240. And you need to increase the font sizes to fill the space up.
Now you lost me lol... I am such a noob it took me 2 weeks just to make a copy paste of your code work on my hardware. Any chance you could point me to the part of code that these drawstrings are ? and what do you mean by factor of 488/320... a small 1 line example ? sorry i am being such a pain. Many thanks in advance. Helinick81
tft.drawRoundRect((centreX-45),(centreY-60),(diameter+50),(centreY+diameter/2+50),10,YELLOW); // Draw compass rose
Becomes : tft.drawRoundRect((centreX-45)480/320,(centreY-60)320/240,(diameter+50),(centreY+diameter/2+50),10,YELLOW); // Draw compass rose
Don’t forget the image is drawn so for a larger display the commands have to be changed to draw all the items larger.
do the * 480/320 on anything that has tft.drawRoundRect on ?
There are standard drawing statements too such as drawhorizontal and vertical and if you want to make the compass larger scale that diameter by the same amount.
ok i get what i have to mess with now. can you please clarify why you said 480/320 and 320/240 when my screen works at 320x480 ? what is this 240 all about ? dont get how this * XX/XX works and what it does. Thanks mate. are you an aviator ?
The original screen size is 320x240 and yours is 480x320 so all x drawing has to be 480/320 larger and y drawing 320/240 larger then it all gets scaled up accordingly, of course you could do all this empirically or calculate the ratios eg 480/320 and multiply all the x coordinates by that value for x then the same for y. The smaller screen inevitably makes for a compromise so with extra space you could improve the layout. I’m not an aviator but fly model aircraft (radio control) and find metar weather reports ideal for my hobby flying, most aviators can read the metar without a decoder but maybe not as easily as a improved mmi. There is much data in a typical metar and I’ve included all of the published rules.
Hi
I have managed to make your esp8266 code work on an ESP32 with a 4inch TFT XPT2046 (320x480) module. All is well when i run it on portrait orientation when i change code to rotate it to landscape the entire layout and txt is only on the top left 1/4 of the screen .. as if its running on a small 128x128 screen or something. for the life of me i can not find the resolution in the code.
Regards Helinick81