2.8 tft touchscreen. No text on right side of display.

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
jschnurr
 
Posts: 9
Joined: Tue Jul 08, 2014 6:36 pm

2.8 tft touchscreen. No text on right side of display.

Post by jschnurr »

I am unable to have small text on the right side of the screen when in landscape mode. It is cut off past 240 pixels.

Everything works in portrait mode, or in landscape mode when the text size is 2 or greater. All the sample sketches work flawlessly, so it's not a wiring problem. Pictures attached.
text cut off
text cut off
2014-07-08 17.44.24-1500.jpg (166.44 KiB) Viewed 619 times
Attachments
2014-07-08 17.32.55-1500.jpg
2014-07-08 17.32.55-1500.jpg (193.47 KiB) Viewed 619 times

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by Franklin97355 »

Could you post your code and a description or drawing of your connections between it all?
Please use the code button as shown below.
Code Button.png
Code Button.png (6.65 KiB) Viewed 614 times

jschnurr
 
Posts: 9
Joined: Tue Jul 08, 2014 6:36 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by jschnurr »

Here's the code. I started with the paint example and edited it from there.
All the wire connections are as per the example.

Here's the total code:

Code: Select all

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>

#if defined(__SAM3X8E__)
    #undef __FlashStringHelper::F(string_literal)
    #define F(string_literal) string_literal
#endif

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7

// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 22
//   D1 connects to digital pin 23
//   D2 connects to digital pin 24
//   D3 connects to digital pin 25
//   D4 connects to digital pin 26
//   D5 connects to digital pin 27
//   D6 connects to digital pin 28
//   D7 connects to digital pin 29

// For the Arduino Due, use digital pins 33 through 40
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 33
//   D1 connects to digital pin 34
//   D2 connects to digital pin 35
//   D3 connects to digital pin 36
//   D4 connects to digital pin 37
//   D5 connects to digital pin 38
//   D6 connects to digital pin 39
//   D7 connects to digital pin 40

#define YP A3  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 9   // can be a digital pin
#define XP 8   // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 323);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4

// Assign human-readable names to some common 16-bit color values:
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define BANNED 5
int oldcolor, currentcolor;

void setup(void) {
  Serial.begin(9600);
  
  
  tft.reset();
  
  uint16_t identifier = tft.readID();

  tft.begin(identifier);

  tft.fillScreen(BLACK);

tft.setRotation(1);
  pinMode(13, OUTPUT);
  
tft.setCursor(0,0);
tft.setTextSize(1);
tft.setTextColor(YELLOW);
tft.print("Width: ");
tft.println(tft.width());
tft.setCursor(200,9);
tft.println("In the beginning God created the heavens and the earth. 2 The earth was formless and void, and darkness was over the surface of the deep, and the Spirit of God was moving over the surface of the waters. 3 Then God said, 'Let there be light'; and there was light. ");

}

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{}
By setting tft.setTextSize(1); to tft.setTextSize(2);, then it prints to the right margin and wraps around correctly. But I want to be able to print to the right margin in font size 1.

Here's a picture of the wiring. I suspect it isn't the problem because the display works perfectly otherwise.
2014-07-08 21.48.49-2048.jpg
2014-07-08 21.48.49-2048.jpg (344.91 KiB) Viewed 596 times

jschnurr
 
Posts: 9
Joined: Tue Jul 08, 2014 6:36 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by jschnurr »

Just playing around with it some more tonight. I cannot draw a line past 240 pixels. It is just cut off on the x axis but draws on the y axis (ie drawing a sloped line becomes vertical at x=240, if that makes sense - sorry no picture. my phone is dead).

I can draw rectangles without a problem past x=240. I wonder if there is a bug in the library that prevents text or lines past 240. Have you been able to duplicate the problem?

jschnurr
 
Posts: 9
Joined: Tue Jul 08, 2014 6:36 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by jschnurr »

Here's a couple more pictures. The rectangle function works OK. The filled circle function works OK. The line and hollow circle does not draw past 240 on the x axis.
First the code that is used:

Code: Select all


#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>

#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7

// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 22
//   D1 connects to digital pin 23
//   D2 connects to digital pin 24
//   D3 connects to digital pin 25
//   D4 connects to digital pin 26
//   D5 connects to digital pin 27
//   D6 connects to digital pin 28
//   D7 connects to digital pin 29

// For the Arduino Due, use digital pins 33 through 40
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 33
//   D1 connects to digital pin 34
//   D2 connects to digital pin 35
//   D3 connects to digital pin 36
//   D4 connects to digital pin 37
//   D5 connects to digital pin 38
//   D6 connects to digital pin 39
//   D7 connects to digital pin 40

#define YP A3  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 9   // can be a digital pin
#define XP 8   // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 323);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4

// Assign human-readable names to some common 16-bit color values:
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define BANNED 5
int oldcolor, currentcolor;

void setup(void) {
  Serial.begin(9600);


  tft.reset();

  uint16_t identifier = tft.readID();

  tft.begin(identifier);

  tft.fillScreen(BLACK);

  tft.setRotation(1);
  pinMode(13, OUTPUT);

  tft.setCursor(0,0);
  tft.setTextSize(1);
  tft.setTextColor(YELLOW);
  tft.print("Width: ");
  tft.println(tft.width());

// Draw different shapes.

  tft.drawLine(50,50,320,240,RED);
  tft.fillRoundRect(200, 20, 100,50, 20, GREEN);
  tft.drawRect(150, 0, 160, 15, BLUE);
  tft.fillCircle(240, 130, 30, MAGENTA);
  tft.drawCircle(240, 130, 35, CYAN);

// draw some sample test

  for(int i=1; i<8; i++){
    tft.setCursor(40 * i,30 * i);
    tft.print(i);
    tft.print("Sample text");
    tft.print(i);
  }

}

void loop()
{
}

2014-07-09 14.47.12-1500.jpg
2014-07-09 14.47.12-1500.jpg (135.39 KiB) Viewed 578 times
In this next picture, the only difference is the font size is set to 2 instead of 1:
2014-07-09 14.47.41-1500.jpg
2014-07-09 14.47.41-1500.jpg (156.68 KiB) Viewed 578 times

User avatar
robertanthony02
 
Posts: 9
Joined: Fri Apr 04, 2014 2:52 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by robertanthony02 »

I'm experiencing the same issue. Lines and text get cut off when in landscape (3) mode. I tried different rotation modes, enabled/disabled text wrapping, and changed font size. The problem does not occur with a font size of 2, as mentioned by the OP. This issue has been around for several months; I hope it gets fixed. Thanks!

User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by adafruit2 »

Oooh thats in 8-bit mode. Yeah 8-bit mode is the TFTLCD lib not ILI9341 lib - for now, you can try using SPI mode (fewer pins, slightly slower, doesn't have this bug!)
We didn't catch it before because we kept testing it in SPI mode!

We'll put in a github issue to look at this shortly!

User avatar
robertanthony02
 
Posts: 9
Joined: Fri Apr 04, 2014 2:52 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by robertanthony02 »

Too late: my project is already set on using 8-bit mode! Luckily the font size I am using is 2 so I don't have a pressing need for a fix. But I do plan on using this screen in future projects and the fast redraw of 8-bit mode may be preferred once again. Thanks for looking into it!

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: 2.8 tft touchscreen. No text on right side of display.

Post by tdicola »

Thanks for providing the great sketches to reproduce the issue. I dug into it a bit more and found there was a bug with the rotation hard coding some limits based on the portrait orientation. I just updated the library to grab the correct limits based on rotation and it looks like it fixes the issues with your examples. Grab the latest library code and give it a shot, let me know if you still see issues.

Here's a quick look at the working example if you're curious:
Image

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”