esp32-driver-nextion
esp32-driver-nextion copied to clipboard
Touch event callback not getting called
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
- Use example code.
- Upload screen to Nextion device.
- 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);
}