Touchscreen programming problem

I have a ESP32S2-MINI and a ILI9488 SPI display with a XPT2046 touchscreen controller.
The display part works fine, but when i try to include the touchscreen controller I get a compile error. How do I rewrite the program to solve the error ??

esphome:
  name: esp-32s-mini-ili9488
  friendly_name: esp_32s_mini_ili9488

esp32:
  board: esp32-s2-saola-1
  framework:
    type: arduino

# WiFi configuration
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "esp-32S-Mini-Ili9488"
    password: "zU5TOJQdFN2m"



logger:
api:
ota:
  platform: esphome  # Specify the platform type for OTA updates

# SPI Configuration for both display and touchscreen
spi:
  - id: spi_display
    clk_pin: GPIO18
    mosi_pin: GPIO12
    miso_pin: GPIO16
  - id: spi_touch
    clk_pin: GPIO7
    mosi_pin: GPIO9
    miso_pin: GPIO11

# Display Configuration (ILI9488)
display:
  - platform: ili9xxx
    model: ili9488
    cs_pin: GPIO35
    dc_pin: GPIO33
    reset_pin: GPIO37
    rotation: 0
    invert_colors: true
    spi_id: spi_display
    lambda: |-
      if (id(touch_x) != -1 && id(touch_y) != -1) {
        it.printf(10, 10, id(font1), "X: %d, Y: %d", id(touch_x), id(touch_y));
      } else {
        it.printf(10, 10, id(font1), "No touch detected");
      }

# Touchscreen Configuration (XPT2046)
touchscreen:
  platform: xpt2046
  cs_pin: GPIO3
  interrupt_pin: GPIO5
  spi_id: spi_touch
  update_interval: 100ms
  calibration:
    x_min: 0
    x_max: 320
    y_min: 0
    y_max: 480
  on_touch:
    then:
      - lambda: |-
          id(touch_x) = get_x();  // Use get_x() method to get the x coordinate
          id(touch_y) = get_y();  // Use get_y() method to get the y coordinate
  on_release:
    then:
      - lambda: |-
          id(touch_x) = -1;
          id(touch_y) = -1;

# Global Variables for Coordinates
globals:
  - id: touch_x
    type: int
    restore_value: no
    initial_value: "-1"
  - id: touch_y
    type: int
    restore_value: no
    initial_value: "-1"

# Custom Fonts
font:
  - file: "fonts/arial.ttf"  # Specify the directory where the font file is located
    id: font1  # Set the font ID to font1
    size: 20

Error message:

/config/esphome/deepseek-32s-mini-ili9488.yaml: In lambda function:
/config/esphome/deepseek-32s-mini-ili9488.yaml:68:26: error: 'get_x' was not declared in this scope
           id(touch_x) = get_x();  // Use get_x() method to get the x coordinate
                          ^~~~~
/config/esphome/deepseek-32s-mini-ili9488.yaml:68:26: note: suggested alternative: 'get_sp'
           id(touch_x) = get_x();  // Use get_x() method to get the x coordinate
                          ^~~~~
                          get_sp
/config/esphome/deepseek-32s-mini-ili9488.yaml:69:26: error: 'get_y' was not declared in this scope
           id(touch_y) = get_y();  // Use get_y() method to get the y coordinate
                          ^~~~~
/config/esphome/deepseek-32s-mini-ili9488.yaml:69:26: note: suggested alternative: 'get_sp'
           id(touch_y) = get_y();  // Use get_y() method to get the y coordinate
                          ^~~~~
                          get_sp

I have tried the suggested alternative but with no luckā€¦
Any ideas ??