Adafruit 2,8" tft v2 speed up

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mixus_minimax
 
Posts: 5
Joined: Fri Jul 04, 2014 12:55 am

Adafruit 2,8" tft v2 speed up

Post by mixus_minimax »

HI there, I'm quite new to µc and arduino as well, so my question could be a little bit silly.
I`m using an uno R3, an Adafruit gps logger shield and the mentioned Adafruit 2,8" tft v2. I would like to print the actual position on the display. It works already quite fine, thx to the tutorial, but if the position changes, the display simply overwrites the data, so you can't read it any longer. I added a fillscreen command, but it takes quite a long time to fill the whole screen and display the new data.
Are there other ways to reduce the "refresh time" or to overwrite the text fast?

I connected the display over digital 9-13 due to " TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO" (<<-- like in the graphicstest example) were unknown to my program (TFT_CS, TFT_DC are set). How could I define TFT_MOSI, ... and will it cost other digital ports or is it an additional set of channels.

btw...is it also possible to save data to the sd slot on the display ( I have one on the gps shield and another on the tft)?

Thanks for any information

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

Re: Adafruit 2,8" tft v2 speed up

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 639 times

mixus_minimax
 
Posts: 5
Joined: Fri Jul 04, 2014 12:55 am

Re: Adafruit 2,8" tft v2 speed up

Post by mixus_minimax »

Hi Franklin,
I directly connect the shields (sticking them on each other uno - gps shield - 2,8" tft)

Code: Select all

#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
TinyGPS gps;
SoftwareSerial ss(8, 7);

void setup()
{
ss.begin(9600); 
  tft.begin();
}

void loop(void)
{

tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setRotation(1);
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(3);
  tft.println("flat");
  tft.println(flat_neu);
  tft.setCursor(0, 60);
  tft.setTextColor(ILI9341_RED);  tft.setTextSize(3);
  tft.println("lon-start");
  tft.println(LON_start);
  smartdelay(1000);
}
I reduced the code because its quite long and hope the relevant parts are still in it, even it wont run due to the missing declarations and functions.
After the

Code: Select all

tft.fillScreen(ILI9341_BLACK);
command it takes quite long time to clear the screen. Are there other commands for refreshing?
thx
andreas

User avatar
asteroid
 
Posts: 300
Joined: Tue Oct 22, 2013 9:10 pm

Re: Adafruit 2,8" tft v2 speed up

Post by asteroid »

>smartdelay(1000);

This doesn't run on my system. If you are wanting the loop to run faster, wouldn't this slow it down?

User avatar
asteroid
 
Posts: 300
Joined: Tue Oct 22, 2013 9:10 pm

Re: Adafruit 2,8" tft v2 speed up

Post by asteroid »

> if the position changes, the display simply overwrites the data, so you can't read it any longer

If the data is printed repeatedly in the same location, then would it be possible to create a 'text box' and refresh just this small rectangle instead of the entire screen?

Code: Select all

#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
//TinyGPS gps;
SoftwareSerial ss(8, 7);

byte outputValue = 0;
void setup()
{
  tft.begin();  
  tft.fillScreen(ILI9341_BLACK);
}

void loop(void)
{
  outputValue += 8;
  tft.setRotation(1);
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(3);
  tft.println("flat");
  tft.setCursor(0, 60);
  tft.setTextColor(ILI9341_RED);  tft.setTextSize(3);
  tft.fillRect(0, 40, 120, 140, ILI9341_BLACK);
  tft.println(outputValue);
}

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit 2,8" tft v2 speed up

Post by adafruit_support_mike »

Try using:

Code: Select all

tft.setTextColor( ILI9341_WHITE, ILI9341_BLACK );
the second value is a background color.

If you don't specify a background color, the GFX library will only write the pixels for each character. If you do specify a color, the GFX library will fill every pixel in the character box with either the foreground color (the character) or the background color (erasing what was there before).

mixus_minimax
 
Posts: 5
Joined: Fri Jul 04, 2014 12:55 am

Re: Adafruit 2,8" tft v2 speed up

Post by mixus_minimax »

Asteroid wrote:>smartdelay(1000);

This doesn't run on my system. If you are wanting the loop to run faster, wouldn't this slow it down?
Hi asteroid, the smartdelay comes from the tiny gps sketch from mr. Hart. I guess i need the command, because i would like to ask the gps receiver every second. Maybe a normal delay would work also. Btw i dont need a faster loop but a faster refresh after / in the loop ..

Thx for the idea with the recangle, i will try it tomorrow

mixus_minimax
 
Posts: 5
Joined: Fri Jul 04, 2014 12:55 am

Re: Adafruit 2,8" tft v2 speed up

Post by mixus_minimax »

adafruit_support_mike wrote:Try using:

Code: Select all

tft.setTextColor( ILI9341_WHITE, ILI9341_BLACK );
the second value is a background color.

If you don't specify a background color, the GFX library will only write the pixels for each character. If you do specify a color, the GFX library will fill every pixel in the character box with either the foreground color (the character) or the background color (erasing what was there before).
Nice hint mike, it looks simple :) i will try it tomorrow.
How about the save function of the tft shield?

NOW it is tomorrow :)
It really works fast as it should, thx a lot Mike.
Is it possible to print gps positions as dots on the screen, that the path can bee seen. (I would like to say "start in the middle of the screen and set the next dot depending on the direction I move"), maybe also with a rescale if I move outside the display space.
What would be neccessary to do it without writing to eeprom or to consume to much space (I guess filling an array would overflow the memory)?
Last edited by mixus_minimax on Wed Jul 09, 2014 2:24 am, edited 1 time in total.

User avatar
asteroid
 
Posts: 300
Joined: Tue Oct 22, 2013 9:10 pm

Re: Adafruit 2,8" tft v2 speed up

Post by asteroid »

> Thx for the idea with the recangle, i will try it tomorrow

I think that you will like Mike's solution better.

mixus_minimax
 
Posts: 5
Joined: Fri Jul 04, 2014 12:55 am

Re: Adafruit 2,8" tft v2 speed up

Post by mixus_minimax »

regarding my unanswered questions from earlier posts...
1." Is it possible to print gps positions as dots on the screen, that the path can bee seen. (I would like to say "start in the middle of the screen and set the next dot depending on the direction I move"), maybe also with a rescale if I move outside the display space.
What would be neccessary to do it without writing to eeprom or to consume to much space (I guess filling an array would overflow the memory)?"
2. is it also possible to save data to the sd slot on the display ( I have one on the gps shield and another on the tft)?
any suggestions?
and I have new questions
3. my sketch runs continuesly only IF I activate the serial monitor. While hanging only on usb or external power supply it restarts after 30 sec (usb) 48 sec (external battery)
4. is the 100mA from the data sheet the maximum power consumption for the tft shield?? how about the "Adafruit Ultimate GPS Logger Shield - Includes GPS Module" maximum power consumption?
best regards

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit 2,8" tft v2 speed up

Post by adafruit_support_mike »

mixus_minimax wrote:1." Is it possible to print gps positions as dots on the screen, that the path can bee seen.
Sure. You'd need to work out the code that translates changes in GPS coordinates to changes in screen position though.

Once you've converted the GPS reading to a point on the screen, you can save that in an array. The size of the array will be limited by the amount of memory you use for other things.
mixus_minimax wrote:2. is it also possible to save data to the sd slot on the display ( I have one on the gps shield and another on the tft)?
The SD library only supports communication with a single card, but yeah, you can write data to the card.

In all our shields, the SD card is an independent circuit. You can use it if you want to, but can use the shield without a card. That means all SD code is the same regardless of what shield or breakout you're using. Check the tutorial for more details:

https://learn.adafruit.com/adafruit-mic ... d-tutorial
mixus_minimax wrote:3. my sketch runs continuesly only IF I activate the serial monitor. While hanging only on usb or external power supply it restarts after 30 sec (usb) 48 sec (external battery)
When you disable the serial monitor, do you also disable all the Serial.print() commands that try to talk to it? The String class is notorious for chewing up and fragmenting SRAM.
mixus_minimax wrote:4. is the 100mA from the data sheet the maximum power consumption for the tft shield??
That sounds about right. Most of the power consumption is due to the LED backlight.
mixus_minimax wrote:how about the "Adafruit Ultimate GPS Logger Shield - Includes GPS Module" maximum power consumption?
Those max out at around 40mA (just the GPS module, no SD card activity). The actual amount of power consumption over time will depend on how quickly you have the module polling for position.

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

Return to “Arduino Shields from Adafruit”