Touch screen touch issue

Hi, I'm using the 3.95" touchscreen tft for MEGA2560 with the ILI9488 microchip in it and I'm coming into a little bit of a conundrum when it comes to programming it. I just managed to figure out using the sample codes how to make a button and get it to touch, what I want to do is make a little touch screen keypad for my project so a number can be input much like a calculator.

I've created a number 1 button, and a number 2 button. The number 1 button works fine and multiplies by 10 and adds 1 to the count value. However whenever I touch the number 2 button, it seems to perform the number 1 button function first then the number 2 function. As in it multiplies by 10 adds 1 then multiplies by 10 and adds 2. I'm wondering if this is due to how my loop is written.

void loop(void)
{
  px = 0;
  py = 0;
  my_touch.TP_Scan(0);
  if (my_touch.TP_Get_State()&TP_PRES_DOWN) 
  {
    px = my_touch.x;
    py = my_touch.y;
  } 
  if(is_pressed(70,110,220,260,px,py))
  {
    count = count * 10;
    count = count + 1;
    show_number( count, 150, 180, 3, YELLOW, BLACK, 0, 0);
       delay(100);
  }
  
  if(is_pressed(140,150,220,260,px,py))
  {
    count = count * 10;
    count = count + 2;
    show_number( count, 150, 180, 3, YELLOW, BLACK, 0, 0);
       delay(100);
  }
  
}

The is_pressed command is formatted in the way of x min x max y min y max for the touch. I'm not that good at programming so I wouldn't know how to figure this out. When I swap the order of the two it seems to print a 2 then a 1 as if it is skipping the other if statement.

Never mind, I figured out the issue, The is_pressed is using x1 y1 x2 y2 and I was putting it in as x1 x2 y1 y2.

Gosh I feel rather dumb now!

Nah. Not dumb, just a wee bit too quick to turn out for help.

Most of the problems I think I might need help with get solved (by me) while I am trying to think how to present it to the heavies here…

and in a fair percentage of those, I do find something that I would feel dumb about, not gonna, I am not dumb, maybe just unfocused and careless. :expressionless:

a7