Quicker response with LCD

So I’m fairly new at everything arduino, including the TFT touch screen by Adafruit… I’m trying to program some touch options, and so far so good, I’ve been doing baby steps and troubleshooting as I go… Up until this point I’ve been doing okay.

I’ve tried to update analog input paramaters on the screen, and so far the only way that I can find to draw the numbers on the display is to do a tft.setCursor followed by a tft.println. (any better way of doing this??)
The section of code that I use is as follows and is in the void loop (){ section.

for (scans = 0; scans < 10; scans ++) { 
if (scans < 10) {
  continue;
}
else {
  scans = 0;
  
     // DATA REFRESH ROUTINE
    // Keeps data up to date on the current page
    #define bagpage_x  133
    #define bagpage_y1 25
    #define bagpage_y2 85

    
    if (page == 1) {
      tft.setTextSize(5);
      tft.setTextColor(MAGENTA);
      tft.setCursor(bagpage_x, bagpage_y1);
      tft.println(lfactual);
      tft.setCursor(bagpage_x, bagpage_y2);
      tft.println(lfpress);
    }
    if (page == 2) {
      tft.setTextSize(5);
      tft.setTextColor(MAGENTA);
      tft.setCursor(bagpage_x, bagpage_y1);
      tft.println(rfactual);
      tft.setCursor(bagpage_x, bagpage_y2);
      tft.println(rfpress);
    }
    if (page == 3) {
      tft.setTextSize(5);
      tft.setTextColor(MAGENTA);
      tft.setCursor(bagpage_x, bagpage_y1);
      tft.println(lractual);
      tft.setCursor(bagpage_x, bagpage_y2);
      tft.println(lrpress);
    }
    if (page == 4) {
      tft.setTextSize(5);
      tft.setTextColor(MAGENTA);
      tft.setCursor(bagpage_x, bagpage_y1);
      tft.println(rractual);
      tft.setCursor(bagpage_x, bagpage_y2);
      tft.println(rrpress);
    }
    if (page == 7) {
      tft.setTextSize(3);
      tft.setTextColor(WHITE);
      tft.setCursor(13, 35);
      tft.println(lfactual);
      tft.setCursor(274, 35);
      tft.println(rfactual);
      tft.setCursor(140, 35);
      tft.println(tankactual);
      tft.setCursor(13, 94);
      tft.println(lractual);
      tft.setCursor(274, 94);
      tft.println(rractual);
    }    
}}

Now… That being said… When I change screens the ‘page’ number changes, and that pulls up different data that maps to different parts of the applicable screen. Up until I added this bit of code, everything operated smoothly and quickly… But when I added the part from ‘//data refresh routine’ on down, it was really slow. So my idea was to execute this code (and refresh the data) every tenth scan… I know I have to add a clear part to keep the numbers from piling up on top of each other, but like I said… baby steps.

Am I going about this all wrong? Is there a much easier way? I’m open to suggestions. Please keep everything straight forward and easy for me to wrap my mind around… I know, easier said than done. The main thing is that I’m trying to keep the other portion of the text ( the touch part) as responsive as possible. Are there any good guidelines on how to achieve this?

    #define bagpage_x  133
    #define bagpage_y1 25
    #define bagpage_y2 85

These do not belong in the middle of a for loop. Put them at the top of the code.

      tft.println(lfactual);

Most LCDs do strange things when they get a carriage return/line feed. You are specifying where every piece of text goes. What useful purpose does the carriage return/line feed perform?

Your for loop to determine what to do is silly. Apparently, you've never heard of the modulo operator.

if(scans % 10 == 0) // refresh needed
{
}

If you want to stick to the for loop, change the logic so the refresh happens when conditions are right, or nothing happens. continue; in a program is almost always a clue that the code needs to be rewritten.

In 25+ years of C/C++ coding, I have never used it.

so far the only way that I can find to draw the numbers on the display is to do a tft.setCursor followed by a tft.println.

That's generally now it is done.

Up until I added this bit of code, everything operated smoothly and quickly... But when I added the part from '//data refresh routine' on down, it was really slow.

So, before you added this code, you weren't writing to the LCD at all, and after you added it, you discovered that sending data to the LCD is not fast.

That's the way I read that statement.

If I am reading it wrong, then you need to post all of your code, especially the part that draws on the LCD quickly.