esp32-driver-nextion icon indicating copy to clipboard operation
esp32-driver-nextion copied to clipboard

Touch event callback not getting called

Open stijnb1234 opened this issue 9 months ago • 1 comments

Description

I implemented the driver using the example in the README. When I touch my screen, I don't get a call on the callback.

Reproduction Steps

  1. Use example code.
  2. Upload screen to Nextion device.
  3. No callback is getting called.

Expected behavior

It should just call the callback function.

Actual behavior

Nothing

Display serie.

Discovery

Display model.

NX4832F035

IDF version.

v5.2.1

Espressif SoC revision.

ESP32-WROOM-32U

Debug Logs.

No response

Other information

Do I need to change anything in the Nextion config / scripts to make the callback event work?

bool Touchscreen::init() {
  nextion = nextion_driver_install(TOUCH_UART_PORT, TOUCH_BAUDRATE,
                                   TOUCH_TX_PIN, TOUCH_RX_PIN);
  ESP_OK_CHECK_RETURN(nextion_init(nextion));

  if (!nextion_event_callback_set_on_touch(nextion, callback_touch_event)) {
    ESP_LOGE(TAG, "Failed to set touch event callback");
    return false;
  }

  return true;
}

/* static */ void Touchscreen::callback_touch_event(nextion_on_touch_event_t event) {
  ESP_LOGI(TAG, "Touch event: page_id=%d, component_id=%d", event.page_id,
           event.component_id);
}

stijnb1234 avatar May 06 '24 13:05 stijnb1234